# Ledger tools for assistants

> What an AI assistant can read and write in your books over MCP: the read tools behind every report and list, the write tools for customers, items, bills, journals and categorisations, the file API and the published skills.

Source: /help/en/api/ledger-tools-for-assistants

An assistant connected to Alya Books works with the same functions the app uses. Every page you can open has a **read tool** with the same filters, every write goes through a preview and a token ([Preview, confirm and undo](/help/en/api/preview-confirm-and-undo)), and the **skills** tell the assistant the order of steps for a workflow. Lists return at most 100 rows per page.

## Read tools

| What you look at | Tool | Filters |
| --- | --- | --- |
| Profit and loss, balance sheet, cash flow, equity | `get_financial_statement` | key, from, to, periods, granularity, compare, dimension |
| Report library (ageing, VAT by box, …) | `run_report`, `list_report_definitions` | from, to, asOf, account, contact, dimension |
| Trial balance, general ledger, account register | `get_trial_balance`, `get_general_ledger`, `get_account_register` | from, to, dimension |
| Ledger lines across accounts, one account's balance | `list_ledger_lines`, `get_account_balance` | account, contact, journal, dimension, dates, state, q |
| Journals, entries, chart of accounts, dimensions, fiscal years | `list_journals`, `list_journal_entries`, `get_journal_entry`, `list_accounts`, `list_dimensions`, `list_fiscal_years` | state, journal, dates, keyword, type |
| Is a date open? | `get_period_lock_state` | date, journal, module |
| Bank lines and the triage queue | `list_bank_transactions`, `list_bank_triage` | status, account, contact, dates, view, q |
| Schedules, fixed assets, loans, budgets | `list_schedules`, `list_fixed_assets`, `list_loans`, `list_budgets`, `get_budget_vs_actual` | module, status, class, fiscal year |
| Documents | `list_documents`, `get_document_file`, `download_document` | folder, source, linked record, shared, dates, sort |
| Close periods, tasks, proposed changes, findings | `list_close_periods`, `list_close_tasks`, `list_period_change_proposals`, `list_close_findings` | status, group, owner, q |
| VAT returns, corporate tax computations | `list_vat_returns`, `list_ct_computations`, `get_ct_computation` | status, dates, fiscal year |
| Approvals, audit log, change batches, sync state | `list_approvals`, `list_audit_events`, `list_change_batches`, `get_sync_state` | status, subject, requester, dates, q |

## Write tools

- **Customers and items**: `create_customer`, `update_customer`, `create_product`, `update_product`. Updates are patches: only the fields sent change. Pass `version` (the record's `updatedAt`) so a change someone else made in between is refused with `version_conflict` instead of overwritten; REST clients send the same value as `If-Match`.
- **Bills**: `create_bill`, `get_bill`, `update_bill`. A bill's header, lines, service periods and dimensions change while it is a draft or under review; once accepted or booked only due date, notes, references and custom fields change (`bill_posted`): void it with a reason and record it again.
- **Journals**: `create_journal_entry`, `update_journal_entry` (drafts only), `post_journal_entry`, `reverse_journal_entry`.
- **Bank**: `update_categorisation` and `update_bank_transaction` change the memo, the proposal fields and the splits of a line; the amount and date of a bank-synced line never change (`bank_line_immutable`). `categorise_bank_transaction`, `match_bank_transaction` and `post_bank_proposals` post.
- **Documents**: `upload_document`, `link_document`, `set_document_shared` (visible to the client in the portal).
- **A whole book from a file**: `start_ledger_import` reads a file from the document hub (a Tally XML export, a CSV or a JSON file) and previews it without posting; `confirm_ledger_import` (asks) hands it to the scheduler, which posts it as one batch within a minute; `get_ledger_import` follows the progress; `cancel_ledger_import` (asks) stops it, keeping what posted. No row travels in a tool call; `import_journal_entries` with `rows` stays for a short file.
- A write dated in a locked period becomes a **proposed change** for an approver (`status: proposed`); the assistant tells you who can approve it on the close checklist.

## The file API

`GET /documents/files` pages (`page`, `perPage`), sorts (`sort` = date, name, size, linked; `order`) and filters (`folderPath`, `source`, `linkedEntityType` with the aliases `client` for a contact and `work_item` for a close task, `linkedEntityId`, `shared`, `q`, `from`, `to`). `POST /documents/files` uploads a file and can link it to a client or a work item; `PATCH /documents/files/{id}` sets `shared`; `GET /documents/files/{id}/download` answers a signed link that lasts 15 minutes, as invoice PDFs do.

## Skills

A **skill** is a short Markdown file (`SKILL.md`) that teaches an assistant a workflow: which tools to call in which order, what to confirm with you, where to stop. Alya Books publishes six: `alya-bookkeeping` (invoices, bills, payments), `alya-bank-review` (triage, confirm, post, undo), `alya-month-end-close` (the checklist, proposed changes, sign-off, lock), `alya-vat-return` (diagnostics to Record EmaraTax submission), `alya-corporate-tax` (mapping to computation) and `alya-migration` (imports). Each names the tools it uses and the API version it was written for.

- In the assistant: ask it to call `list_skills`, then `load_skill` with the name; or read the resource `skills://<name>`.
- For a coding agent or a repository: `npx skills add <repository>` installs the files.
- **Setup → API access → API keys**, card **Agent skills**, lists the skills with their version; `GET /skills` and `GET /skills/{name}` serve them.

## Good to know

- The tool list an assistant sees depends on its scopes, tiers and your role ([MCP scopes, tiers and tool permissions](/help/en/api/mcp-scopes-and-tool-permissions)).
- A chart import that meets an account type it does not know reports the account by code and name (`unknown_account_type`) instead of dropping the row; a journal import names the row of every error.
- Requests pin an API version with `X-Api-Version`; a skill's version is the version it was written for.

## Related

- [Preview, confirm and undo](/help/en/api/preview-confirm-and-undo)
- [Connect Alya Books to Claude or ChatGPT](/help/en/api/connect-ai-assistants)
- [Run a month-end close](/help/en/close/run-a-month-end-close)
- [Document hub and receipts](/help/en/documents/document-hub-and-receipts)
