Skip to main content
Glama
OpenTelemetry MCP Server

OpenTelemetry MCP Server

by traceloop

Get Llm Usage

get_llm_usage

Retrieve aggregated LLM token usage metrics for a time period, broken down by model and service, to track consumption and compare usage across providers.

Instructions

Get aggregated LLM usage metrics (token counts) for a time period.

Provides breakdowns by model and service.

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

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum traces to analyze (default: 1000)
end_timeNoEnd time in ISO 8601 format
start_timeNoStart time in ISO 8601 format
service_nameNoFilter by service name
gen_ai_systemNoFilter by LLM provider
gen_ai_request_modelNoFilter by requested model name
gen_ai_response_modelNoFilter by actual model used

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses that results are aggregated and broken down by model and service, which is genuine behavioral context. It does not disclose that the 'limit' parameter caps how many traces are analyzed (so totals may be truncated) or state that this is a read-only operation; the word 'get' only weakly implies that.

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?

Two short sentences with no filler. The core purpose is front-loaded and the second sentence adds only useful information about output shape.

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

Completeness3/5

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

An output schema exists, so return values need not be explained. The remaining gap is behavioral: with zero annotations, the description should state that the aggregation is bounded by the 'limit' trace count and is a read-only query, since silently truncated totals would mislead an agent.

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 all seven parameters are already documented in the schema and the baseline is 3. The description adds only that filtering is over 'a time period' and that output is broken down by model and service; it does not clarify how the limit interacts with aggregation accuracy or how the model filters combine.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource: 'Get aggregated LLM usage metrics (token counts)' scoped to a time period, with breakdowns by model and service. It is clear what the tool returns, but it never distinguishes itself from plausible siblings such as get_llm_model_stats or get_llm_expensive_traces, so an agent must infer the boundary.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'aggregated ... for a time period' with 'breakdowns by model and service' implies the use case: summary-level token accounting rather than per-trace inspection. However, no explicit when-to-use condition, no when-not-to-use, and no named alternative is given, so the agent has to infer routing from the sibling list.

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