Skip to main content
Glama

Agent Billing Primitives (Dirtsmith)

agent_spend_ledger

agent_spend_ledger

Agent spend cap / budget ledger: set a budget, reserve before pay (atomic, never overspends even with many agents in parallel), then settle or release. Idempotent, shared by namespace. Spending limit, budget guard, cost control for AI agents. Every call requires a tiny solved packet (returned in the reply, 2 s, one try); free first call, no API key (GET /try?tool=agent_spend_ledger).

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": {
      "namespace": "<namespace>",
      "action": "<action>",
      "budget_id": "<budget_id>",
      "idempotency_key": "<idempotency_key>"
    },
    "name": "agent_spend_ledger"
  }
}

Input Schema

NameRequiredDescriptionDefault
memoNo
ttl_sNo
actionYes
sourceNo
budget_idYes
caller_idNodemo_caller
namespaceYes
limit_microsNo
amount_microsNo
reservation_idNo
idempotency_keyYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/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 behavioral burden and discloses atomicity, no overspend under parallel agents, idempotency, namespace sharing, and the tiny solved-packet auth requirement including free first call and no API key. It still omits retry/error semantics and action-specific side effects, leaving some gaps.

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 text is front-loaded and compact, moving from purpose to workflow to idempotency/concurrency to auth. It is slightly dense and includes a redundant keyword-style sentence ('Spending limit, budget guard, cost control for AI agents'), but overall it earns its space.

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 an 11-parameter mutation-style ledger tool with no annotations, no schema descriptions, and no output schema, the description gives a useful high-level workflow and concurrency/auth guarantees. However, it leaves out action-parameter mapping, units, TTL behavior, reservation semantics, and response expectations, so it is only minimally complete.

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

Parameters2/5

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

The input schema has 0% description coverage across 11 parameters, so the description must explain parameter meaning. It only indirectly suggests namespace, budget_id, idempotency_key, and the action values through the named operations, while never explaining amount_micros vs limit_micros, ttl_s, reservation_id, caller_id, source, or memo.

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?

It states a specific resource and concrete operations: set a budget, reserve, settle, and release against an agent spend ledger. The phrasing 'Agent spend cap / budget ledger' and cost-control framing distinguishes it from sibling tools like lease locks, semaphores, and heartbeat registries.

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 a clear lifecycle: set a budget, reserve before paying, then settle or release. It implies when to use the tool for spend caps, but it does not explicitly name alternatives or state when not to use it, so it stops short of a 5.

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.