> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Melso MCP: https://mcp.melso.ai/mcp (OAuth; one company per connection). Documentation-search MCP: https://docs.melso.ai/mcp; it does not act on customer accounts.
>
> Use the live tool list and respect company membership. Ask the person to approve the exact invoice or tax return version in the signed-in app. Melso's professionals prepare and file included returns after approval; an AI assistant does not file. A prepared file or an approval is not evidence of filing: only the AEAT's reference and receipt are. Keep credentials out of chat and logs.

# accounting

> When to use the accounting MCP tool, its input, actions, output and a worked example.

A company's books as its adviser reads them. journal: the libro diario in date order; account lists an account's ledger (libro mayor), each entry with only that account's lines. trial\_balance: the year's sumas y saldos from 1 January to `to`, by account the opening balance, debit, credit and closing balance (debit positive); groups 6 and 7 start the year at zero and earlier results not yet applied show where the books reopened them (129 or 120); without prefix it groups by 4 digits, and at most 400 accounts are listed (accounts\_omitted counts the rest: narrow with prefix). statements: the annual accounts in the PGC's normal model (pérdidas y ganancias, balance) beside the year before; detail adds each line's accounts. corporate\_tax: the year's Impuesto sobre Sociedades (modelo 200) from the books and the saved inputs, the 202 instalments it sets with their deadlines, and review codes to check; its rate's kind is general (25 %), small\_company (empresa de reducida dimensión: the year before's turnover under 10 M€, art. 101 LIS: 24 % in 2025, 23 % in 2026), micro\_company (under 1 M€) or new\_entity (15 %). Each 202 instalment's amount is what the company pays, by its method: 40.2 is 18 % of the last return's cuota (on\_last\_return); 40.3 is the year's base so far at period\_rate, 5/7 of the year's rate rounded down: 16 % for 23 %, 17 % for 24 % or 25 % (on\_period\_base), and is compulsory above 6 M€ of turnover (compulsory\_period\_base). Its version is the expected\_version of corporate\_tax\_update and corporate\_tax\_filed. corporate\_tax\_update saves only the fields supplied and answers the recalculated tax; a year whose 200 was filed (filed) changes only with rectification, when the person asks to rectify that return. corporate\_tax\_filed records a 200 filed outside Melso (the day and the result filed, which must equal Melso's calculation): the 202 instalments then build on the return filed (art. 40.2), whatever the year's books or inputs say later. Amounts are EUR decimal strings. No action approves, files or pays a return. Each action accepts only its own fields (\* required): journal(account, cursor, from, limit, to); trial\_balance(year\*, digits, prefix, to); statements(year\*, detail); corporate\_tax(year\*); corporate\_tax\_update(year\*, expected\_version\*, adjustments, capitalization\_reserve, deductions, instalments, losses\_offset, new\_entity, period\_base, prior\_turnover, rectification, withholdings, workforce\_growth); corporate\_tax\_filed(year\*, expected\_version\*, filed\_on\*, payable\*).

**Availability:** Empresa.

The live tool list is authoritative: the company's plan and your role can narrow this contract. [Understand access](/mcp/permissions).

## When to use

Use it to read an empresa's books the way its adviser does: the journal and an account's ledger (`journal`), the trial balance (`trial_balance`), the annual accounts (`statements`) and the year's corporate tax with its 202 instalments (`corporate_tax`). It is listed only for an empresa with accounting; `corporate_tax_update`, which saves what the books cannot say (adjustments, the capitalization reserve, deductions), also needs a plan with the tools. The owner still approves the 200 in the app.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "properties": {
    "account": {
      "description": "Only entries that move an account starting with these digits, e.g. 551 or 47300000.",
      "type": "string"
    },
    "action": {
      "enum": [
        "journal",
        "trial_balance",
        "statements",
        "corporate_tax",
        "corporate_tax_update",
        "corporate_tax_filed"
      ],
      "type": "string"
    },
    "adjustments": {
      "description": "Every adjustment to the accounting result (ajustes extracontables); replaces the saved list.",
      "items": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "description": "EUR decimal string: positive raises the taxable base (a non-deductible expense), negative lowers it.",
            "type": "string"
          },
          "concept": {
            "description": "What the adjustment is, with the article it rests on, e.g. \"Multa (art. 15.c LIS)\".",
            "type": "string"
          },
          "temporary": {
            "description": "True when it reverses in later years (a temporary difference with a deferred tax).",
            "type": "boolean"
          }
        },
        "required": [
          "concept",
          "amount"
        ],
        "type": "object"
      },
      "maxItems": 50,
      "type": "array"
    },
    "capitalization_reserve": {
      "description": "Apply the capitalization reserve (art. 25 LIS): the company records an unavailable reserve of that amount from the year's result.",
      "type": "boolean"
    },
    "cursor": {
      "description": "next_cursor of the previous page.",
      "type": "string"
    },
    "deductions": {
      "description": "EUR decimal string: deductions and rebates (deducciones, bonificaciones).",
      "type": "string"
    },
    "detail": {
      "description": "Include the accounts behind each line.",
      "type": "boolean"
    },
    "digits": {
      "description": "Group accounts by their first digits (3 for the plan's accounts); 0 keeps the books' subaccounts.",
      "maximum": 12,
      "minimum": 0,
      "type": "integer"
    },
    "expected_version": {
      "description": "version from corporate_tax_get; 0 when nothing was saved yet.",
      "minimum": 0,
      "type": "integer"
    },
    "filed_on": {
      "description": "The day the 200 was filed, YYYY-MM-DD.",
      "type": "string"
    },
    "from": {
      "description": "First day YYYY-MM-DD.",
      "type": "string"
    },
    "instalments": {
      "description": "EUR decimal string: the year's 202 instalments paid; empty to take them from the books.",
      "type": "string"
    },
    "limit": {
      "description": "Entries per page, 50 by default.",
      "maximum": 200,
      "minimum": 1,
      "type": "integer"
    },
    "losses_offset": {
      "description": "EUR decimal string: negative bases of earlier years offset.",
      "type": "string"
    },
    "new_entity": {
      "description": "A company in its first or second year with a positive base (15 %).",
      "type": "boolean"
    },
    "payable": {
      "description": "EUR decimal string: the result filed (casilla 01586), negative for a refund.",
      "type": "string"
    },
    "period_base": {
      "description": "The company opted for the 202 on the year's result so far (art. 40.3 LIS).",
      "type": "boolean"
    },
    "prefix": {
      "description": "Only accounts starting with these digits, e.g. 47 for the tax accounts.",
      "type": "string"
    },
    "prior_turnover": {
      "description": "EUR decimal string: the year before's turnover (importe neto de la cifra de negocios), which sets the rate; empty to take it from the books.",
      "type": "string"
    },
    "rectification": {
      "description": "Required to change a year whose 200 was filed (filed in corporate_tax_get): the change prepares a rectification of that return, which the 202 instalments ignore until it is filed and recorded. Only when the person asks to rectify the return.",
      "type": "boolean"
    },
    "to": {
      "description": "Last day YYYY-MM-DD.",
      "type": "string"
    },
    "withholdings": {
      "description": "EUR decimal string: withholdings suffered (retenciones e ingresos a cuenta); empty to take them from the books.",
      "type": "string"
    },
    "workforce_growth": {
      "description": "Growth of the average workforce over the year before, in percent; it raises the reserve's percentage from 2025.",
      "maximum": 1000,
      "minimum": 0,
      "type": "integer"
    },
    "year": {
      "description": "The fiscal year, such as 2025.",
      "maximum": 2100,
      "minimum": 2000,
      "type": "integer"
    }
  },
  "required": [
    "action"
  ],
  "type": "object"
}
```

## Actions

The tool's schema combines the fields of every action. Each action accepts only its own fields below; send `action` with them.

### Read actions

These actions only read. They change nothing.

<AccordionGroup>
  <Accordion title="corporate_tax">
    The year's corporate tax (Impuesto sobre Sociedades, modelo 200) as Melso calculates it from the books and the saved inputs: result before tax, adjustments, capitalization reserve available and applied, negative bases, taxable base, rate, cuota íntegra and líquida, withholdings, instalments paid and what is left to pay, deferred tax and the books' charge; plus the 202 instalments that build on it, with deadlines. filed is the 200 filed for the year (null until it is recorded or Melso files it; differs when Melso's calculation no longer gives it), and once it is there the instalments build on it (last\_return\_filed). deadline\_passed: the 200's deadline is over, so the year was most likely filed. review lists what to check. version is the expected\_version for corporate\_tax\_update and corporate\_tax\_filed.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "year": {
          "description": "The fiscal year, such as 2025.",
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "year"
      ],
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="journal">
    The company's libro diario in date order: each entry's number, kind (opening, normal, regularization, closing), source and lines with account, name, concept, debit and credit. account lists an account's ledger (libro mayor): only the entries that move an account starting with those digits, each with only that account's lines (other\_lines counts the rest). A full page carries next\_cursor.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "account": {
          "description": "Only entries that move an account starting with these digits, e.g. 551 or 47300000.",
          "type": "string"
        },
        "cursor": {
          "description": "next_cursor of the previous page.",
          "type": "string"
        },
        "from": {
          "description": "First day YYYY-MM-DD.",
          "type": "string"
        },
        "limit": {
          "description": "Entries per page, 50 by default.",
          "maximum": 200,
          "minimum": 1,
          "type": "integer"
        },
        "to": {
          "description": "Last day YYYY-MM-DD.",
          "type": "string"
        }
      },
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="statements">
    The year's annual accounts in the PGC's normal model: the profit and loss account (cuenta de pérdidas y ganancias) and the balance sheet at the year's end, each line keyed as the modelo 200 files it, beside the year before. detail adds the accounts behind each line.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "detail": {
          "description": "Include the accounts behind each line.",
          "type": "boolean"
        },
        "year": {
          "description": "The fiscal year, such as 2025.",
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "year"
      ],
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="trial_balance">
    The year's trial balance (balance de sumas y saldos) from 1 January to to: by account, the balance carried into the year, the year's debit and credit and the balance at the end (debit positive, credit negative). Groups 6 and 7 start the year at zero; earlier results not yet applied show where the books reopened them (129 or 120). Without prefix it groups by 4 digits; with prefix it shows the full subaccounts that start with it. At most 400 accounts are listed; accounts\_omitted counts the rest.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "digits": {
          "description": "Group accounts by their first digits (3 for the plan's accounts); 0 keeps the books' subaccounts.",
          "maximum": 12,
          "minimum": 0,
          "type": "integer"
        },
        "prefix": {
          "description": "Only accounts starting with these digits, e.g. 47 for the tax accounts.",
          "type": "string"
        },
        "to": {
          "description": "Last day YYYY-MM-DD within the year; the year's end by default.",
          "type": "string"
        },
        "year": {
          "description": "The fiscal year, such as 2025.",
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "year"
      ],
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

### Write action

It saves the corporate tax's inputs and needs a plan with the tools. It does not approve or file the 200.

<AccordionGroup>
  <Accordion title="corporate_tax_filed">
    Record that the year's 200 was filed outside Melso, as by the company's previous adviser: the day and the result filed (casilla 01586 of the return, negative for a refund), which must equal what Melso calculates for the year (corporate\_tax\_get); when it does not, the answer refuses with Melso's figure, and the adjustments or inputs need correcting first. The 202 instalments then build on the return filed and a later change to the year is a rectification. Record a rectification filed later the same way. It files and pays nothing.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "expected_version": {
          "description": "version from corporate_tax_get.",
          "minimum": 0,
          "type": "integer"
        },
        "filed_on": {
          "description": "The day the 200 was filed, YYYY-MM-DD.",
          "type": "string"
        },
        "payable": {
          "description": "EUR decimal string: the result filed (casilla 01586), negative for a refund.",
          "type": "string"
        },
        "year": {
          "description": "The fiscal year, such as 2025.",
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "year",
        "expected_version",
        "filed_on",
        "payable"
      ],
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="corporate_tax_update">
    Save what the year's corporate tax needs beyond the books, at expected\_version from corporate\_tax\_get: only the fields supplied change. Answers the recalculated tax. It does not approve or file the 200: the owner approves the return in the app and Melso's professionals file it.

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "adjustments": {
          "description": "Every adjustment to the accounting result (ajustes extracontables); replaces the saved list.",
          "items": {
            "additionalProperties": false,
            "properties": {
              "amount": {
                "description": "EUR decimal string: positive raises the taxable base (a non-deductible expense), negative lowers it.",
                "type": "string"
              },
              "concept": {
                "description": "What the adjustment is, with the article it rests on, e.g. \"Multa (art. 15.c LIS)\".",
                "type": "string"
              },
              "temporary": {
                "description": "True when it reverses in later years (a temporary difference with a deferred tax).",
                "type": "boolean"
              }
            },
            "required": [
              "concept",
              "amount"
            ],
            "type": "object"
          },
          "maxItems": 50,
          "type": "array"
        },
        "capitalization_reserve": {
          "description": "Apply the capitalization reserve (art. 25 LIS): the company records an unavailable reserve of that amount from the year's result.",
          "type": "boolean"
        },
        "deductions": {
          "description": "EUR decimal string: deductions and rebates (deducciones, bonificaciones).",
          "type": "string"
        },
        "expected_version": {
          "description": "version from corporate_tax_get; 0 when nothing was saved yet.",
          "minimum": 0,
          "type": "integer"
        },
        "instalments": {
          "description": "EUR decimal string: the year's 202 instalments paid; empty to take them from the books.",
          "type": "string"
        },
        "losses_offset": {
          "description": "EUR decimal string: negative bases of earlier years offset.",
          "type": "string"
        },
        "new_entity": {
          "description": "A company in its first or second year with a positive base (15 %).",
          "type": "boolean"
        },
        "period_base": {
          "description": "The company opted for the 202 on the year's result so far (art. 40.3 LIS).",
          "type": "boolean"
        },
        "prior_turnover": {
          "description": "EUR decimal string: the year before's turnover (importe neto de la cifra de negocios), which sets the rate; empty to take it from the books.",
          "type": "string"
        },
        "rectification": {
          "description": "Required to change a year whose 200 was filed (filed in corporate_tax_get): the change prepares a rectification of that return, which the 202 instalments ignore until it is filed and recorded. Only when the person asks to rectify the return.",
          "type": "boolean"
        },
        "withholdings": {
          "description": "EUR decimal string: withholdings suffered (retenciones e ingresos a cuenta); empty to take them from the books.",
          "type": "string"
        },
        "workforce_growth": {
          "description": "Growth of the average workforce over the year before, in percent; it raises the reserve's percentage from 2025.",
          "maximum": 1000,
          "minimum": 0,
          "type": "integer"
        },
        "year": {
          "description": "The fiscal year, such as 2025.",
          "maximum": 2100,
          "minimum": 2000,
          "type": "integer"
        }
      },
      "required": [
        "year",
        "expected_version"
      ],
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

## Output

`journal` returns the entries in date order, each with its lines; a full page carries `next_cursor`, and with `account` each entry keeps only that account's lines (`other_lines` counts the rest). `trial_balance` returns each account's opening balance, debit, credit and closing balance, and `accounts_omitted` when it lists only the first 400. `statements` returns the profit and loss account and the balance sheet beside the year before. `corporate_tax` returns the modelo 200 calculation, the 202 instalments it sets, `review` codes and its `version`. `corporate_tax_update` returns the recalculated tax. None of these approves, files or pays a return.

The result uses MCP `content` blocks; JSON payloads are encoded in text and may also appear in `structuredContent`. Check `isError` before reading a success payload. The server does not declare an `outputSchema`, so rely on the fields named here and in the live result.

## Example

Explain an empresa's corporate tax for 2025 and save an adjustment the person gives you. These are the `arguments` of each call, in order.

<Steps>
  <Step title="Check the tax accounts in the trial balance">
    ```json theme={null}
    {
      "action": "trial_balance",
      "year": 2025,
      "prefix": "47"
    }
    ```
  </Step>

  <Step title="Read the corporate tax and note its version">
    ```json theme={null}
    {
      "action": "corporate_tax",
      "year": 2025
    }
    ```
  </Step>

  <Step title="Save a non-deductible fine at that version">
    ```json theme={null}
    {
      "action": "corporate_tax_update",
      "year": 2025,
      "expected_version": 1,
      "adjustments": [
        {
          "concept": "Multa de tráfico (art. 15.c LIS)",
          "amount": "300.00",
          "temporary": false
        }
      ]
    }
    ```
  </Step>
</Steps>

The first call as a request. Use an OAuth access token issued for this MCP resource and replace the example identifiers with values from your own company. Write actions change data.

```bash theme={null}
curl --fail-with-body https://mcp.melso.ai/mcp \
  -H "Authorization: Bearer $MELSO_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  --data-binary @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "accounting",
    "arguments": {
      "action": "trial_balance",
      "year": 2025,
      "prefix": "47"
    }
  }
}
JSON
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.