Skip to main content
Glama

Save expense

save_expense

Record spending that is NOT settling a document, or edit an existing expense's ACCOUNTING ENTRY (category, supplier, tax); to pay a bill or PO prefer record_document_payment (one document) or settle_bills (several), and to change the BANK LINE itself (its description, ignored flag or notes) use update_transaction. For one expense, send its fields inline (pass an id to update, omit to create). To create/update many at once, send an items array — this is preferred over repeated calls: the whole batch is one all-or-nothing transaction with a single ledger recompute. Each item with an id updates; each without creates. To pay a bill / purchase order / GRN, set accountid to that document's id. Use create_income_expenses_bulk to add income and expenses together in one transaction.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "save_expense"
  }
}

Input Schema

NameRequiredDescriptionDefault
aiNoInternal: set when the expense was produced by AI enrichment.
idNoExpense id. Present → update that expense; omit → create a new one.
dateNoExpense date (ISO 8601).
nameNoDisplay name / description of the expense.
paidNoWhether this expense has been paid.
alertNoAlert/reminder note to surface on this expense.
itemsNoVector of expense objects to create/update in one all-or-nothing batch. Preferred over repeated calls. Each item with an id updates; each without creates.
notesNoFree-text notes.
splitNoWhether this expense is one line of a split transaction.
totalNoTotal including quantity. Used only when amount is omitted: amount becomes total ÷ quantity, and must come to whole cents. If amount is also sent, amount wins.
amountNoUnit amount before quantity/tax, in the record's currency.
methodNoPayment method as free text (e.g. "cash", "card", "eft") — no fixed set.
unlinkNoPass the id of a currently-linked transaction/document to detach it.
groupidNoGroup id linking split lines of one real-world transaction together.
taglistNoTag ids to set on this expense (replaces the existing set).
currencyNoISO 4217 currency code (e.g. "ZAR", "USD"). Defaults to the business currency.
paiddateNoDate payment was made (ISO 8601).
quantityNoNumber of units.
salestaxNoVAT on this expense, as an array of sales tax refs: [{"parentid": "<sales tax id>"}], with ids from list_sales_taxes. Each ref attaches that tax as a VAT row. true alone adds no VAT and is refused, unless the expense already has a VAT row. To add one tax to many saved expenses, use add_salestax_to_entities. Omit it, or send false or [], for no VAT.
supplierNoSupplier id, or an exact supplier name to resolve (see list_suppliers).
accountidNoChart-of-accounts account id (or an exact account name to resolve) used to categorise this expense (see list_accounts). ALSO how a payment is recorded against a purchase document: set this to the bill / purchase order / GRN document id (cont-…) and the expense counts toward that document's paid amount, inheriting the document's accounting category. This is how a money-out document is settled via a pre-existing expense. To record a fresh payment against a bill / purchase order / GRN, prefer record_document_payment — it now handles both directions, minting the accountid-linked expense for you from the payment details. To refund a customer, set this to their id (cli-…): it posts once to Receivables, tagged to them, with no VAT.
exchangerateNoManual FX rate to the business base currency; omit to use the stored/auto rate.
showquantityNoWhether to display the quantity column on the document.
bankaccountidNoBank account id the money moved through (see list_accounts).
baseaccountidNoBase/control account id override; rarely needed — defaults from the category.
transactionidNoBank transaction id to reconcile this expense against.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • changedInput schema / properties / items / items / properties / salestax / description
      Previous value: -"Whether sales tax (VAT) applies. May also be an array of salestax refs."New value: +"VAT on this expense, as an array of sales tax refs: [{\"parentid\": \"<sales tax id>\"}], with ids from list_sales_taxes. Each ref attaches that tax as a VAT row. true alone adds no VAT and is refused, unless the expense already has a VAT row. To add one tax to many saved expenses, use add_salestax_to_entities. Omit it, or send false or [], for no VAT."
    • removedInput schema / properties / items / items / properties / salestaxamount
      Removed value: -{
      -  "description": "Explicit sales tax amount; used instead of the percentage when salestaxuseamount is true.",
      -  "type": "number"
      -}
    • removedInput schema / properties / items / items / properties / salestaxpercent
      Removed value: -{
      -  "description": "Sales tax rate as a percentage (e.g. 15 for 15%).",
      -  "type": "number"
      -}
    • removedInput schema / properties / items / items / properties / salestaxuseamount
      Removed value: -{
      -  "description": "When true, use salestaxamount as the tax figure instead of computing from the percentage.",
      -  "type": "boolean"
      -}
    • changedInput schema / properties / salestax / description
      Previous value: -"Whether sales tax (VAT) applies. May also be an array of salestax refs."New value: +"VAT on this expense, as an array of sales tax refs: [{\"parentid\": \"<sales tax id>\"}], with ids from list_sales_taxes. Each ref attaches that tax as a VAT row. true alone adds no VAT and is refused, unless the expense already has a VAT row. To add one tax to many saved expenses, use add_salestax_to_entities. Omit it, or send false or [], for no VAT."
    • removedInput schema / properties / salestaxamount
      Removed value: -{
      -  "description": "Explicit sales tax amount; used instead of the percentage when salestaxuseamount is true.",
      -  "type": "number"
      -}
    • removedInput schema / properties / salestaxpercent
      Removed value: -{
      -  "description": "Sales tax rate as a percentage (e.g. 15 for 15%).",
      -  "type": "number"
      -}
    • removedInput schema / properties / salestaxuseamount
      Removed value: -{
      -  "description": "When true, use salestaxamount as the tax figure instead of computing from the percentage.",
      -  "type": "boolean"
      -}
  2. Changed2 schema fields changed
    • changedInput schema / properties / accountid / description
      Previous value: -"Chart-of-accounts account id (or an exact account name to resolve) used to categorise this expense (see list_accounts). ALSO how a payment is recorded against a purchase document: set this to the bill / purchase order / GRN document id (cont-…) and the expense counts toward that document's paid amount, inheriting the document's accounting category. This is how a money-out document is settled via a pre-existing expense. To record a fresh payment against a bill / purchase order / GRN, prefer record_document_payment — it now handles both directions, minting the accountid-linked expense for you from the payment details."New value: +"Chart-of-accounts account id (or an exact account name to resolve) used to categorise this expense (see list_accounts). ALSO how a payment is recorded against a purchase document: set this to the bill / purchase order / GRN document id (cont-…) and the expense counts toward that document's paid amount, inheriting the document's accounting category. This is how a money-out document is settled via a pre-existing expense. To record a fresh payment against a bill / purchase order / GRN, prefer record_document_payment — it now handles both directions, minting the accountid-linked expense for you from the payment details. To refund a customer, set this to their id (cli-…): it posts once to Receivables, tagged to them, with no VAT."
    • addedInput schema / properties / items / items / properties / accountid / description
      Added value: +"Chart-of-accounts category account id, or an exact account name to resolve (see list_accounts). Set to a bill / purchase order / GRN document id (cont-…) to record this expense as a payment against that document. Set to a customer id (cli-…) to record a refund paid to that customer: it posts once to Receivables, tagged to the customer, with no VAT, and draws down their credit balance."
  3. Changed2 schema fields changed
    • changedInput schema / properties / items / items / properties / total / description
      Previous value: -"Total amount including quantity; overrides amount×quantity if set."New value: +"Total including quantity. Used only when amount is omitted: amount becomes total ÷ quantity, and must come to whole cents. If amount is also sent, amount wins."
    • changedInput schema / properties / total / description
      Previous value: -"Total amount including quantity; overrides amount×quantity if set."New value: +"Total including quantity. Used only when amount is omitted: amount becomes total ÷ quantity, and must come to whole cents. If amount is also sent, amount wins."
  4. First observed

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare only readOnlyHint=false and destructiveHint=false, and the description adds real behavioral context beyond that: id-present means update versus id-absent means create, and the batch is described as "one all-or-nothing transaction with a single ledger recompute" — genuinely useful for an agent deciding whether to batch. It stops short of covering permissions, what an update overwrites on unmentioned fields, or the return value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but front-loaded: exclusions and alternative routing come first, then the single-vs-batch mechanics. Every sentence is functional, though the bill-payment use of accountid is stated twice (once as a sibling exclusion, once as "set accountid to that document's id"), which is mild redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 26-parameter, zero-required tool with no output schema, the description covers the decisions that matter most: create versus update, batch atomicity, and sibling routing. Its remaining gap is what the call returns (created/updated expense ids), which matters for a tool whose batch form implies the caller needs to know what was saved.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds decision-level meaning by framing the two invocation modes (fields inline for one expense, `items` array for many) and the id-to-update / no-id-to-create rule that governs every param block. It also reinforces accountid's dual role for paying a bill (cont-…) — though that is largely duplicated from the schema, and the txid/taglist/unlink semantics stay in the schema only.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource and an explicit scope boundary: "Record spending that is NOT settling a document, or edit an existing expense's ACCOUNTING ENTRY." It immediately distinguishes itself from record_document_payment, settle_bills, and update_transaction by name, so an agent can route without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives both the when and the when-not, pairing each alternative with the condition that selects it ("to pay a bill or PO prefer record_document_payment (one document) or settle_bills (several)", "to change the BANK LINE itself ... use update_transaction"). It also states a preference: the batch `items` form is preferred over repeated calls.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources