Skip to main content
Glama

analyze_usage

Analyze a local OpenAI or Anthropic usage or cost export offline to explain spend drivers, top-model share, retirement dates, and actionable next steps.

Instructions

Use when an owner says "my agents spend too much, find out why". Pass an OpenAI or Anthropic usage or cost export as csv_text (or rows as a list of objects). Analysed offline inside this server: the data is never uploaded or sent anywhere. Returns spend by model, share of the top models, models on the retirement calendar with days left, visible cost drivers (one expensive model carrying most spend, large uncached prompts, errors and retries, no batch use) and next steps: quick fixes you can apply yourself and, for "is a cheaper model good enough on our tasks?", the free pilot. Columns are matched leniently (case and separators ignored): model | model_name | model_id | snapshot_id | line_item; cost | cost_usd | amount | amount_value | spend; requests | num_model_requests | n_requests; input_tokens | prompt_tokens | n_context_tokens_total | uncached_input_tokens; output_tokens | completion_tokens; cache_read_input_tokens | input_cached_tokens | cached_tokens; cache_creation_input_tokens; errors | error_count | status | status_code; retries | retry_count; batch | service_tier; date | start_time | bucket_start. Only model is required.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "analyze_usage"
  }
}

Input Schema

NameRequiredDescriptionDefault
rowsNo
csv_textNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/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 and does so well: it discloses that analysis happens offline inside the server and data is never uploaded, which is the key trust fact for confidential spend data. It also previews the output categories, which goes beyond requirement. It stops short of stating anything about size limits, processing time, or what happens when neither input is supplied (both params default to null).

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 the scenario and privacy fact, then the return payload, then the input contract — a sensible order with no filler sentences. The long pipe-delimited column alias list is bulky, but since the schema carries zero description text it earns its place; the only cost is that it is dense to scan.

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 two-parameter analysis tool with an output schema, this covers everything an agent needs: when to invoke, what to pass in either form, what columns are recognized, what the response will contain, and where to route the follow-up question. Nothing material is left to guesswork.

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

Parameters5/5

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

Schema coverage is 0% and both parameters are undocumented in the schema, yet the description fully compensates: csv_text accepts a raw usage/cost export, rows accepts a list of objects, and only model is required. The lenient column-matching rules with the full alias list (cost | cost_usd | amount | spend, etc.) add real meaning an agent cannot get from the 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?

States a specific verb and resource ('analyses an OpenAI or Anthropic usage or cost export') and enumerates exactly what comes back: spend by model, top-model share, retirement-calendar models, cost drivers, next steps. The opening scenario ('my agents spend too much, find out why') pins the intent so an agent can tell this apart from benchmark_results, pricing, or estimate_switch_savings.

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?

Gives an explicit trigger condition ('Use when an owner says...'), an explicit input contract (csv_text or rows), and an explicit referral: for the 'is a cheaper model good enough' question it points at the free pilot rather than trying to answer in-tool. The boundary between this analysis and the pilot path is stated, not inferred.

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