> ## 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.

# Leer diarios y libros de IVA — book_imports_read MCP

> MCP book_imports_read: inspect journal, VAT-book and subaccount files, and list saved imports. Live for an empresa.

Read-only actions. Import the books a company kept in another accounting program (ContaPlus, A3, Sage...) from the person's files, sent in the Melso chat (attachment\_id) or uploaded from another client with upload (upload\_id), as the program exports them: its libro diario (book journal), its VAT books (book issued: facturas expedidas, saved as income; book received: facturas recibidas, saved as expenses), which the 303, 390, 347 and 349 then count, and its list of subaccounts (book subaccounts: each one's name and NIF), which names the books' subaccounts. read shows what a file holds and what keeps it from being saved; import saves it whole or not at all. Import journals oldest first: a year's opening then reopens the year before's books. list shows the imports, opening balances included; delete can remove an unposted VAT book, but posted journals and opening balances stay immutable and require explicit reversals in the app. A refused file is never fixed by hand: the person exports it again. Books with no journal to import open with accounting opening\_balance. Each action accepts only its own fields (\* required): read(book\*, attachment\_id, upload\_id); list.

**Availability:** Empresa.

**Access:** Live in the Melso app and over MCP for a signed-in person. Where the partner REST API covers the same area, that path is private beta until Melso enables your account. See [Access and pricing](https://docs.melso.ai/api/access.md).

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

## When to use

Use `book_imports_read` for `list`, `read`. Use [`book_imports`](https://docs.melso.ai/mcp/tools/book-imports) for the companion actions. The live tool list determines availability.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "read"
        },
        "attachment_id": {
          "description": "In the Melso chat: the attachment_id of the file (CSV, TXT or Excel as the accounting program exports it) the person sent, at most 10 MB.",
          "type": "string"
        },
        "book": {
          "description": "journal: the libro diario. issued: the libro de facturas expedidas (sales, saved as income). received: the libro de facturas recibidas (purchases, saved as expenses). subaccounts: the list of subaccounts (subcuentas, plan de cuentas) with each one's name and NIF.",
          "enum": [
            "journal",
            "issued",
            "received",
            "subaccounts"
          ],
          "type": "string"
        },
        "upload_id": {
          "description": "From another client: the upload_id from upload, once the file (CSV, TXT or Excel as the accounting program exports it) was PUT to its upload_url.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "book"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "list"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    }
  ],
  "properties": {
    "action": {
      "enum": [
        "read",
        "list"
      ],
      "type": "string"
    },
    "attachment_id": {
      "description": "In the Melso chat: the attachment_id of the file (CSV, TXT or Excel as the accounting program exports it) the person sent, at most 10 MB.",
      "type": "string"
    },
    "book": {
      "description": "journal: the libro diario. issued: the libro de facturas expedidas (sales, saved as income). received: the libro de facturas recibidas (purchases, saved as expenses). subaccounts: the list of subaccounts (subcuentas, plan de cuentas) with each one's name and NIF.",
      "enum": [
        "journal",
        "issued",
        "received",
        "subaccounts"
      ],
      "type": "string"
    },
    "upload_id": {
      "description": "From another client: the upload_id from upload, once the file (CSV, TXT or Excel as the accounting program exports it) was PUT to its upload_url.",
      "type": "string"
    }
  },
  "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.

> [accordion] list
>
> The journals and VAT books the company imported, the latest first: each with its id, file name, period and counts.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] read
>
> Read a journal or VAT book the person gave without saving it, named with attachment\_id or upload\_id. A journal answers its period, entries, lines and debit total, its kinds (opening, reopening, regularization, closing), how many of Melso's own entries it replaces, and opening\_differences when its opening does not carry the balances the imported books end with. A VAT book answers its period, invoices, those already in Melso (duplicates), the new ones, their totals by kind and rate as the 303 counts them, and the invoices to review. problems and can\_save say what keeps it from being saved. A list of subaccounts answers how many it names and with a tax ID, those Melso has no name for yet (new), those it renames (changed), how many the books move (in\_books), a sample and the rows it skips (the plan's own accounts, groups 8 and 9, rows without a name).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "attachment_id": {
>       "description": "In the Melso chat: the attachment_id of the file (CSV, TXT or Excel as the accounting program exports it) the person sent, at most 10 MB.",
>       "type": "string"
>     },
>     "book": {
>       "description": "journal: the libro diario. issued: the libro de facturas expedidas (sales, saved as income). received: the libro de facturas recibidas (purchases, saved as expenses). subaccounts: the list of subaccounts (subcuentas, plan de cuentas) with each one's name and NIF.",
>       "enum": [
>         "journal",
>         "issued",
>         "received",
>         "subaccounts"
>       ],
>       "type": "string"
>     },
>     "upload_id": {
>       "description": "From another client: the upload_id from upload, once the file (CSV, TXT or Excel as the accounting program exports it) was PUT to its upload_url.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "book"
>   ],
>   "type": "object"
> }
> ```

## Output

`read` returns what a journal, VAT book or subaccount list holds and the checks that determine whether it can be saved. `list` returns prior imports, latest first.

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. When the server declares an `outputSchema`, it is reproduced below. Check the action result and its declared fields before reporting success.

## Example

Use the actions of this tool in the order shown; its companion tool covers the other actions. These are the `arguments` of each call, in order.

**1. Read the journal without saving it**

```json theme={null}
{
  "action": "read",
  "book": "journal",
  "upload_id": "11111111-1111-4111-8111-111111111111"
}
```

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.

```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": "book_imports_read",
    "arguments": {
      "action": "read",
      "book": "journal",
      "upload_id": "11111111-1111-4111-8111-111111111111"
    }
  }
}
JSON
```


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