Skip to main content
Glama

record_spend

Records a run's actual input and output token usage in a local per-task ledger, priced at the model's list rates.

Instructions

Record a run's actual token usage in the local per-task ledger.

Args: task_id: Caller-chosen identifier grouping one task's runs. model_id: Model the run used. input_tokens: Actual input tokens consumed. output_tokens: Actual output tokens consumed.

Returns the recorded entry, priced at the model's list rates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes
model_idYes
input_tokensYes
output_tokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

With no annotations, the description carries the full burden. It discloses the persistence target ('local per-task ledger') and the return ('priced at the model's list rates'), but says nothing about whether repeated calls for the same task_id append or overwrite, whether the write is reversible, or what happens when model_id is unknown to the pricing table. For a mutation tool with zero annotation coverage this is thin.

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

Conciseness5/5

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

Front-loaded purpose sentence, then a compact Args block where every line adds semantics absent from the schema, then a one-line return note. No filler or repetition.

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

Completeness4/5

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

Covers purpose, all four parameters, and the return shape without an output schema. The gap is behavioral: no guidance on idempotency/append semantics or error cases, which matters for a ledger-writing mutation with no annotations to lean on.

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 description coverage is 0%, so the description must compensate, and it does: all four parameters are documented with meaning beyond their names, notably task_id as a 'caller-chosen identifier grouping one task's runs' and the input/output token counts as 'actual' consumption. Only model_id is restated near-tautologically.

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?

States a specific verb and resource with scope: 'Record a run's actual token usage in the local per-task ledger.' The word 'actual' implicitly contrasts with the estimation siblings (estimate_run_cost, price_usage), but no sibling is named explicitly, so the differentiation is left to inference.

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?

Usage is implied rather than stated: recording 'actual' usage signals the post-run scenario as opposed to the estimation tools. There is no explicit when-to-use, no named alternative, and no prerequisite (e.g., whether the model must already be priced).

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