Skip to main content
Glama

caching_analytics

Read-only

Analyze prompt-cache performance to measure hit rates, cache-read tokens, estimated USD savings, and per-agent cache-hit breakdown over a chosen time window.

Instructions

Prompt-cache insights (read from the tracing store): overall cache hit rate, cache-read tokens, estimated USD saved, a cached-vs-uncached token time series, and a per-agent cache-hit-rate breakdown. A focused slice of the Live Monitor / /admin/live/analytics.json for "how much are we saving from caching / which agents cache well". Cache-read is read from the auto-instrumented gen_ai.usage.cache_read_input_tokens span attribute (deduped to the LLM span); hit rate = cache_read / total input tokens. hours is clamped to [1, 8760]; trace_env (dev|staging|prod|'') scopes to traces tagged with that environment (environment is the deprecated alias); env (staging|prod) selects the config branch used to price the savings estimate.

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": "caching_analytics"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNoConfig branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves.staging
hoursNoLook-back window in hours (clamped to 1-8760).
trace_envNoEnvironment tag of the traces to scope telemetry to (dev|staging|prod); '' = all environments.
agent_kindNoOnly this agent kind.
environmentNoDEPRECATED alias of trace_env.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true; the description goes well beyond by naming the data source (tracing store), the underlying span attribute (gen_ai.usage.cache_read_input_tokens, deduped to the LLM span), and the exact hit-rate formula. It also discloses clamping and deprecation behavior, which the agent could not infer from annotations.

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-loads the metric list and the positioning statement before the technical details, and every sentence carries information. It is dense with parentheticals and backticked identifiers, and the env/trace_env sentences partially duplicate the schema, but nothing is truly wasted.

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?

An output schema exists, yet the description still names the returned metrics so an agent can choose the tool without reading it, and it covers data provenance, metric definition, and parameter scoping. Nothing needed to invoke it correctly is missing.

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% and the schema already documents clamping, the deprecated alias, and the config-branch meaning of env. The description largely restates those facts, adding only marginal meaning (that env is used to price the savings estimate). Baseline 3 is appropriate when the schema carries the parameter documentation.

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 resource (prompt-cache insights) and enumerates exactly what is produced: hit rate, cache-read tokens, estimated USD saved, cached-vs-uncached time series, per-agent breakdown. It also positions itself against the broader sibling by calling itself 'a focused slice of the Live Monitor / /admin/live/analytics.json'.

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 a concrete question-shaped use case ('how much are we saving from caching / which agents cache well') and implies the broader live_analytics is the alternative by describing this as a slice of it. It does not explicitly say when NOT to use it or name live_analytics as the fallback in so many words.

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