Skip to main content
Glama

WritersLogic agent-infra

spend-ledger

Spend ledger with reservations: one budget for a tree of agents — A budget shared by a task tree, in integer minor units. 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 snapshot: two workers cannot both reserve the last dollar. It records spending; it does not move money.

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.6/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the behavioral burden. It discloses important traits: atomic reservation, automatic expiry of holds, real concurrency guarantees, and that the tool records spending without moving money. It omits auth/tenant handling and idempotency details, which appear only in 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.

Conciseness4/5

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

The description is front-loaded and mostly efficient, with the core reservation model stated first. There is minor redundancy in the opening budget phrasing, but the operational sentences earn their place.

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 tool with no annotations and no output schema, the description covers the central reservation semantics but leaves gaps around open/status behavior, authentication, idempotency, and return values. It is adequate but not complete.

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 description coverage is 78%, so the schema already documents most parameters well. The description adds useful meaning for reserve, commit, and release amounts, but it does not explain open, status, currency, tenantId, requestId, ttlSeconds, or reservationId beyond what the schema provides.

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 and operation set: a shared spend ledger with reserve, commit, and release semantics. It clearly says it records spending rather than moving money, but it does not explicitly distinguish itself from the sibling reconcile-ledger tool.

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 explains what reserve, commit, and release do, which implies when those operations are appropriate. It does not give explicit when-to-use guidance versus alternatives, nor does it cover the open and status operations.

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