Skip to main content
Glama

Settle bills

settle_bills
DestructiveIdempotent

Settle a batch of bills in one call — each pair links a bill / purchase order / GRN (cont-…) to its payment: either an existing expense (expense) or a bank transaction (transaction: a bank-feed transaction's own unallocated expense is re-pointed at the bill; an unlinked transaction gets a new expense linking the two). Money-out settle = an expense whose accountid is the bill's id. record_document_payment settles ONE bill at a time (minting the expense from payment fields); this tool instead LINKS an existing expense or bank transaction and settles a whole batch, which the chat loop can't do with N single settles. Each pair is applied INDEPENDENTLY: one failing (missing/locked/bad ref) never aborts the rest. Every id (bill, expense, transaction) is owner-scoped; an already-settled bill, or a transaction whose expense already pays that bill, is a safe no-op (not a failure), so re-running the same batch is harmless. A transaction allocated elsewhere (income, another bill or category, several expenses) fails with a reason naming the allocation. A bank transaction slightly ABOVE the bill (a bank fee, at most 3% of the outstanding, same currency) is not refused: it comes back status "proposed" with a proposal {type bank-charge, amount, accountid 201, accountname Bank Charges, outstanding, paid} and NOTHING is written. Show the user the fee; only once they confirm, re-send the same pair with bankcharge = proposal.amount to settle the bill and post the fee to Bank Charges in one transaction (re-sending again is an already-settled no-op). Above 3% the over-settle refusal stands. Returns {results [{bill, status "settled"|"already-settled"|"proposed"|"failed", expenseid, created, bankchargeid, proposal, reason}], settled, already-settled, proposed, failed} — expenseid is the undo handle and created=false means the expense pre-existed (undo by UNLINKING it, never deleting); bankchargeid is the minted fee expense (safe to delete). Max 100 pairs per call. Only run after the user has confirmed the proposed matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pairsYesThe confirmed bill↔payment pairs to reconcile. Each is applied independently.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / pairs / items / properties / bankcharge
      Added value: +{
      +  "description": "Confirms a proposed bank-charges line (:transaction case). A payment above the bill by at most 3% of its outstanding comes back \"proposed\" with the fee and writes nothing. Re-send the pair with bankcharge = that proposal's amount, only after the user confirms, to settle the bill and post the fee to Bank Charges.",
      +  "type": "number"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / pairs / items / properties / transaction / description
      Previous value: -"A bank transaction id to settle the bill from — a new expense is created linking the transaction to the bill. Provide this OR :expense, not both."New value: +"A bank transaction id to settle the bill from. A bank-feed transaction's own unallocated expense is re-pointed at the bill; an unlinked transaction gets a new expense linking it to the bill. Provide this OR :expense, not both."
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations carry the basic profile (write, idempotent, destructive); the description goes far beyond — spelling out the idempotency mechanism (already-settled bills are safe no-ops on rerun), per-pair independent failure, the 'proposed'/bank-charge flow that writes NOTHING until re-confirmed, owner-scoping, the 3% over-settle rule, and the 100-pair cap. Undo semantics (unlink, never delete; bankchargeid safe to delete) add context no annotation captures. 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?

Purpose is front-loaded and every sentence earns its place — the tool's complexity justifies the length. The weakness is structural: it is one dense unbroken paragraph, and separating the proposal flow, the return format, and the limits would materially improve scanability.

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?

With no output schema, the description fully specifies the return structure and its semantics (expenseid as undo handle, created flag, bankchargeid, proposal object, statuses, reason). Covers limits, failure modes, prerequisites, and edge cases (3% over-settle threshold, allocated-elsewhere failures, max 100 pairs). Nothing an agent needs to invoke this complex tool correctly is missing.

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; the description raises it by clarifying execution semantics — how the :transaction case re-points a bank-feed expense vs mints a new one, how bankcharge interacts with a 'proposed' result, and how the confirmation gate drives re-invocation. This is workflow meaning beyond the field descriptions, though the schema already documents each field well.

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?

States a specific verb and resource — 'Settle a batch of bills in one call' — and lays out both settlement modes (linking an existing expense or a bank transaction). Explicitly differentiates itself from the sibling record_document_payment (single vs batch, linking vs minting), so an agent can tell them apart without any schema inspection.

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?

Names the alternative tool explicitly (record_document_payment) and gives the selection criterion: batch settlement with existing payments vs one-at-a-time with minted expenses, including a note that the chat loop cannot use N single settles. Also provides a hard gate: 'Only run after the user has confirmed the proposed matches.'

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