Skip to main content
Glama

agent_cost

Generate a multi-agent cost report from Claude Code transcripts: tokens, API cost, capacity intensity, and top runs. Use after a fan-out to review consumption or before to compare with the last run.

Instructions

Multi-agent cost report from Claude Code's own transcripts on this machine: tokens moved (cache read/write, fresh input, output), valued cost at API list prices (marked NOTIONAL on a subscription, UNPRICED when no rate matches), capacity intensity (subagents, failed, died at window, tool calls per agent, cache reuse), top runs, and context_burn / fanout_without_canary signals. Call it after a fan-out to read what it consumed, or before one to compare with the last. Thresholds come from .contextengine/policy.json agent_cost, else built-in defaults.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
runNoFilter by run id (wf_... or task group id)
topNoHow many runs to list (default 10)
daysNoOnly runs started within the last N days
jsonNoReturn the structured JSON report instead of the text one
projectNoFilter by project slug as it appears in ~/.claude/projects (e.g. -Users-yan-Projects-ContextEngine)
sessionNoFilter by parent session id
policy_dirNoAbsolute path of the repo whose .contextengine/policy.json supplies agent_cost thresholds and rates. Default: the MCP server's working directory, which under launchd is the home dir, not a repo; the report names which source it used on its 'thresholds:' line

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.9.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It details the data source (local transcripts), cost basis (API list prices), special markers (NOTIONAL/UNPRICED), capacity metrics, and threshold fallback from policy.json. It implies a read-only report but never explicitly states side effects or access requirements, so it's not a 5.

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?

Three dense sentences front-load the report's contents, then give usage timing and threshold sources. The metric enumeration makes it longer than minimal, but every sentence contributes information the agent needs.

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?

The description covers what the report contains, where the data comes from, pricing caveats, threshold sources, and when to call it. Given no output schema and no annotations, this is fairly complete, though it lacks an explicit example and an unambiguous side-effect statement.

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 100%, so the baseline is 3. The description adds general context about thresholds and report contents but does not add per-parameter meaning beyond what each schema property already states.

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 it produces a 'Multi-agent cost report' from Claude Code's own transcripts on this machine, listing specific metrics (tokens, cost, capacity intensity, top runs, signals). The resource and scope are precise and clearly differentiate it from sibling tools like run_audit or score_project.

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?

Gives explicit timing guidance: 'Call it after a fan-out to read what it consumed, or before one to compare with the last.' This is clear context, but the description does not name alternative tools or when-not-to-use conditions, 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.