Skip to main content
Glama

analyze_costs

Analyze Claude Code and Anthropic API token spend by scrubbing local transcripts and uploading usage metadata to return cost summaries with recoverable savings.

Instructions

Analyze your Claude Code / Anthropic API token spend. Sweeps your local transcripts (or apilog JSONL files via apilog glob), scrubs identifiers on your machine, sends usage metadata only to your configured Agent Cost Lens server, and returns the cost summary with recoverable savings. Dates are YYYY-MM-DD. Use preview_upload first to audit what gets sent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceNo
untilNo
apilogNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.2

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and performs admirably. It discloses that the tool sweeps local transcripts, scrubs identifiers on the machine, sends only usage metadata to a configured server, and returns recoverable savings—key behavioral and privacy-relevant traits beyond what the schema shows.

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?

The description is compact and well-structured: one sentence states the core purpose, a second explains the operational flow, and the final sentence gives the date format and the prerequisite audit step. No sentences are wasted, and the most important context is front-loaded.

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

Completeness5/5

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

For a tool with three optional params, an output schema, and one sibling, the description provides comprehensive context: data sources, local processing, network transfer, return value, date format, and a safety instruction to preview first. Nothing critical is missing for an agent to invoke it correctly.

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. It does by clarifying that 'since' and 'until' are dates in YYYY-MM-DD format and that 'apilog' is a glob for JSONL files. It doesn't explain default semantics when these optional params are omitted, but it adds meaningful meaning beyond the raw schema.

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?

The description begins with a specific verb and resource: 'Analyze your Claude Code / Anthropic API token spend.' It then details the full workflow (sweeping transcripts, scrubbing identifiers, sending only usage metadata, returning a cost summary), making the tool's purpose concrete and distinguishable from the sibling preview_upload by framing preview_upload as a preliminary audit step.

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 clear usage context, including the date format (YYYY-MM-DD) and an explicit sequencing instruction: 'Use preview_upload first to audit what gets sent.' It stops short of describing when not to use this tool or alternative conditions, but the guidance is sufficient for an agent to know when and how to proceed.

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

Deploy Server

Other Tools