Skip to main content
Glama

spend-ledger

Spend ledger with reservations: one budget for a tree of agents — A budget shared by a task tree, in integer minor units. Call open(currency, budgetMinor) once per ledger first; every other op answers unknown NO_LEDGER until then. reserve() atomically holds an amount if the remaining budget covers it (expired holds are freed automatically); commit() records what was actually spent, up to the hold; release() frees a hold. These are real reservations, not a snapsh

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "op": "<op>",
      "ledger": "<ledger>"
    },
    "name": "spend-ledger"
  }
}

Input Schema

NameRequiredDescriptionDefault
opYes
ledgerYesLedger name, e.g. task:research-42.
currencyNoopen: currency or token code, e.g. USD or USDC.
tenantIdNoRequired for API-key callers (namespaced as key:<tenantId>; keep it unguessable). Ignored when a wallet paid: the payer address is the tenant.
requestIdNoCaller-chosen id for this mutation. A retry with the same id and same input returns the stored response (24 h) instead of applying twice; the same id with different input is rejected. Send one on every mutation you may retry: without it a retry is applied again (fleet-memory record appends a duplicate; a repeated spend-ledger commit or release answers NO_HOLD because the first call already took effect).
ttlSecondsNoreserve: hold lifetime; default 600.
amountMinorNoreserve: amount to hold. commit: amount actually spent (at most the hold).
budgetMinorNoopen: total budget in minor units.
reservationIdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full behavioral burden and does substantially well: atomic holds, automatic freeing of expired holds, the NO_LEDGER failure mode, and the explicit claim that these are real reservations rather than a snapshot. The final sentence is cut off mid-word ('not a snapsh'), so whatever caveat it was about to add about durability or accounting semantics is lost, and authorization/tenant scoping is left entirely to the schema.

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 lead is well front-loaded and op-by-op sequencing is easy to scan. However, the opening clause is redundant ('one budget for a tree of agents — A budget shared by a task tree') and the text terminates mid-sentence, which is a real structural defect rather than a stylistic one.

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

Completeness3/5

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

For a nine-parameter, multi-operation mutation tool handling money with no annotations and no output schema, the description covers the happy path and the NO_LEDGER case well. It leaves out what reserve actually returns, how reservationId flows into commit/release, and what status reports — gaps an agent must guess at before it can complete a full hold-then-spend cycle.

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

Parameters3/5

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

Schema coverage is 78% with unusually rich per-parameter text, so the baseline is 3. The description does add cross-parameter meaning the schema cannot express, such as pairing open with (currency, budgetMinor) and tying amountMinor to reserve versus commit. But reservationId is never mentioned in prose and the schema gives it no description at all, leaving the key question — whether reserve returns an id that commit and release require — unaddressed.

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

Purpose4/5

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

The description states a specific resource (a spend ledger of atomic reservations, denominated in integer minor units) and enumerates the lifecycle verbs it exposes: open, reserve, commit, release. An agent can tell exactly what domain this covers. It does not, however, distinguish itself from the similarly named sibling reconcile-ledger or say which one to reach for first.

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?

Ordering guidance is explicit and load-bearing: call open(currency, budgetMinor) once per ledger first, and every other op will answer NO_LEDGER until then. Each op's condition is also spelled out (reserve holds only if remaining budget covers it; commit records up to the hold). What is missing is when to prefer this over a sibling reconciliation tool or when a caller should skip reservations entirely.

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