Skip to main content
Glama
ninetails-io

gnucash-mcp

pay_invoice

Record a payment against an invoice or bill from your bank account, handling partial payments, currency exchange gains/losses, and early-payment discounts.

Instructions

Record a payment against a posted invoice or bill.

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

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: Invoice or bill 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. owner_type: "customer" or "vendor" for disambiguation. 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
memoNo
forceNo
amountYes
fx_accountNo
owner_typeNo
descriptionNo
payment_dateNo
apply_discountNo
payment_accountYes
discount_accountNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it does so comprehensively. It reveals the auto-routing logic for fx_account and discount_account (with matching rules and fallback behavior), the fx_notice return signal for ambiguous candidates, specific rejection conditions for discounts and stale FX rates, the force override behavior, and the memo-vs-description distinction. It also notes the 7-90 day stale-FX guard and the 90-day un-forceable cap — rich operational detail beyond what any schema could convey.

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

Conciseness3/5

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

The description is dense and technically thorough but quite long, spanning multiple paragraphs plus a labeled Args section. The front-loaded first sentence is strong, but the extensive FX routing and discount sections add substantial length before the Args list, creating some redundancy (the prose section restates the auto-resolution details that the Args also cover). It's structured and scannable, but could be tightened by ~25-30% without losing information.

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 the tool's high complexity (11 params, cross-currency FX handling, discount validation, stale-rate guards) and zero schema description coverage, the description is remarkably complete. It explains the payout flow, both advanced routing policies, error/rejection behaviors, override semantics, and edge cases (multiple/count zero FX matches, credit-note rejection for discounts). The output schema exists, so return-format details are relieved; for a complex financial mutation tool this is about as complete as one could expect.

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?

Schema description coverage is 0%, so the description carries the full load for all 11 parameters. Every nontrivial parameter is explained: id (specific format example '000001'), payment_account and amount (format examples), fx_account/discount_account (GUID/path/percent-short matching accepted), apply_discount (explicit opt-in, hard-reject conditions), force (stale-FX guard details), and memo (distinguished from description). This far exceeds what bare parameter titles provide.

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 clear verb+resource statement: 'Record a payment against a posted invoice or bill.' It then distinguishes subtypes (partial payments, cross-currency with FX splits, early-payment discounts), each with concrete specifics. It clearly differentiates itself from sibling tools like apply_credit_note (which handles credit notes) and create_transaction (which is generic), establishing pay_invoice as the invoice-settlement action.

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

Usage Guidelines4/5

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

The description gives strong context on when to use the tool: for posted invoices/bills with A/R or A/P payment, partial payments, and cross-currency or discount scenarios. It doesn't explicitly name alternative tools for when NOT to use it (e.g., apply_credit_note for credit-based settlement), but the payment-vs-credit distinction is implicit and the prerequisite ('posted invoice') is clearly stated. Explicit exclusions would push this to 5.

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

Install Server

Other Tools

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