Skip to main content
Glama

record_usage

Record actual token usage for a completed LLM call. Cost is computed server-side from current pricing, never trusted from the caller — this is the 'actual spend' counterpart to estimate_cost's hypothetical numbers. Usage is attributed to your org. Resubmitting the same request_id for the same org is a no-op. Use when the user wants to log or track real LLM spend, not just estimate it. Requires your service API key on the MCP connection (x-api-key or Authorization: Bearer); org_id defaults to, and must match, that key's org.

Input Schema

NameRequiredDescriptionDefault
org_idNoOptional organisation ID to attribute this usage to. Defaults to, and must match, the org of the service key on the MCP connection
model_nameYesName of the LLM model that was called
request_idNoOptional idempotency key — resubmitting the same value is a no-op
session_idNoOptional session ID to tag this event with, so it can later be grouped and retrieved via analyze_session_usage — e.g. a bounded burst of calls like a coding-agent run or a chat session
occurred_atNoUnix timestamp when the call happened (default: now)
input_tokensYesNumber of input tokens actually used
output_tokensYesNumber of output tokens actually used

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / org_id / description
      Previous value: -"Optional organisation ID to attribute this usage to"New value: +"Optional organisation ID to attribute this usage to. Defaults to, and must match, the org of the service key on the MCP connection"
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

No annotations are supplied, and the description carries the full burden well: it discloses that cost is computed server-side and never trusted from the caller, that duplicate request_ids are a no-op, that usage is attributed to the caller's org, and what credentials the MCP connection must carry. That is exactly the mutation/auth/idempotency context an agent needs before writing data.

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?

Front-loaded with purpose and the estimate_cost contrast, which is the highest-value sentence. A few clauses are redundant with the schema (org attribution repeated twice), costing a little density, but every sentence still contributes.

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?

For a 7-parameter write tool with no annotations, the description covers purpose, auth, idempotency, and attribution. It stops short of stating what is returned (e.g. a computed cost value) and omits the session_id grouping hint that matters for the analyze_session_usage workflow, leaving a small gap.

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 100%, so every parameter is already described in the schema, and the description largely restates those (org_id defaulting/matching, request_id idempotency). It adds no format or range guidance for input_tokens/output_tokens and never mentions session_id or occurred_at, so no credit above the baseline.

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 ("Record actual token usage for a completed LLM call") and immediately scopes it against the sibling estimate_cost ("the 'actual spend' counterpart to estimate_cost's hypothetical numbers"). An agent can distinguish this from estimate_cost, compare_costs, and import_session_usage without opening a schema.

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?

Explicit trigger ("Use when the user wants to log or track real LLM spend, not just estimate it") plus an explicit exclusion pointing at the alternative. The idempotency note also tells the agent it is safe to retry with the same request_id.

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.