Skip to main content
Glama
ninetails-io

gnucash-mcp

pay_document

Settle open invoices, bills, vouchers, and credit notes by recording payments from a bank or cash account, with support for partial payments, discounts, and cross-currency FX adjustments.

Instructions

Record a payment against a posted customer invoice, vendor bill, employee voucher, or credit note.

Creates a payment transaction from the specified bank/cash account to the document's A/R or A/P account. Partial payments are supported.

dry_run=true rehearses the payment without booking it: the full validation, conversion, discount, and FX pipeline runs and the response shows the proposed splits, the remaining balance after, whether the invoice would settle in full, and any account the real call would auto-create. Same inputs, same code path — a rehearsal that succeeds is a payment that will book. Recommended before complex payments (cross-currency, discounts, credit-note refunds).

For cross-currency payments where the rate moved between post-date and pay-date, a realized FX gain/loss split is booked. Pass fx_account to control routing; otherwise the server picks the unique INCOME/EXPENSE account whose leaf name matches "fx", "forex", "foreign exchange", "currency gain/loss", "exchange gain/loss", or "currency translation". When zero or multiple match, the canonical Income:Foreign Exchange Gain/Loss is used (auto-created if absent), and an fx_notice is returned listing ambiguous candidates so you can pass fx_account explicitly next time.

For invoices with early-payment-discount terms (e.g., "2/10 Net 30" = 2% off if paid within 10 days), pass apply_discount=True to settle via discount. The tool validates that the invoice has discount terms, the payment date is within the discount window, and the shortfall matches the expected discount on pre-tax principal. Each failure mode rejects with a specific error rather than silently downgrading to a partial payment. discount_account controls routing the same way fx_account does (auto-resolves to Expenses:Sales Discounts for customer payments, Income:Purchase Discounts Taken for vendor bill payments).

Args: id: Document ID (e.g., "000001"). payment_account: Bank or cash account for payment (e.g., "Assets:Checking"). amount: Payment amount as decimal string (e.g., "500.00"). payment_date: Payment date (YYYY-MM-DD). Defaults to today. description: Description for the payment transaction. Optional. document_type: "invoice", "bill", "voucher", or "credit_note" — disambiguates when IDs collide. party_type: Owner side, credit notes only. fx_account: Optional INCOME or EXPENSE account to receive realized FX gain/loss (cross-currency payments only). Accepts a full path, %short GUID, or full 32-char GUID. apply_discount: When True, treat this payment as the final settlement and absorb the early-payment discount from the invoice's billterm. Default False — explicit opt-in. Hard-rejects on credit notes (refunds don't take discounts). discount_account: Optional INCOME or EXPENSE account to receive the discount split. Auto-resolves when omitted. Accepts full path, %short GUID, or full 32-char GUID. force: Override the stale-FX-rate guard. A cross-currency payment etches the rate at pay time; if the latest price is 7–90 days from the payment date the payment is refused with stale_fx_rate unless force=True (the override is recorded as fx_stale/"forced"). A rate beyond the 90-day cap cannot be forced. memo: Optional memo for the bank-account split (e.g., check number or wire reference). description names the whole transaction; memo annotates the cash movement. dry_run: When True, rehearse without writing — returns the proposed splits and projected outcome instead of booking. Default False.

Returns: status is "paid" when the document settles to zero, "partial" when a balance remains, and "would_pay" on dry runs — plus the amount paid, remaining balance, and transaction reference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
memoNo
forceNo
amountYes
dry_runNo
fx_accountNo
party_typeNo
descriptionNo
payment_dateNo
document_typeNo
apply_discountNo
payment_accountYes
discount_accountNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Addedv1.4.4

TDQS

A4.5/5.0
Behavior5/5

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

Annotations (readOnlyHint=false) indicate a mutation, but the description goes far beyond: it explains the dry_run rehearsal, cross-currency FX gain/loss booking, discount term validation, the force guard for stale rates, and the three possible statuses. No contradiction with annotations.

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 long but well structured: purpose, dry_run, FX, discount, Args list, Returns. It is front-loaded with the core action and each paragraph adds necessary detail. Some redundancy could be trimmed, but the organization aids comprehension.

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

Completeness5/5

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

Given 13 parameters and complex behaviors (FX, discount, dry_run, force), the description covers all critical edge cases, error paths, and return semantics. The output schema is present, but the description still explains the status values and transaction reference, making it complete for an agent.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by documenting all 13 parameters with concrete examples (e.g., id: '000001', payment_account: 'Assets:Checking'), accepted formats (e.g., GUID variants for fx_account), and defaults. It adds meaning the schema lacks.

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 first sentence states a specific action ('Record a payment') against a clear resource ('posted customer invoice, vendor bill, employee voucher, or credit note'). It distinguishes itself from sibling operations like post_document or apply_credit_note by focusing on the payment act.

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

Usage Guidelines3/5

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

The description clarifies the intended input (posted documents) and mentions partial payments, but it does not explicitly contrast with alternatives (e.g., apply_credit_note for credit notes). Guidance is implied rather than explicit, leaving some ambiguity about when not to use it.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ninetails-io/gnucash-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server