Skip to main content
Glama

get_llm_usage

Aggregate LLM token usage metrics over a time period, with breakdowns by model and service, to track and analyze consumption.

Instructions

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

Provides breakdowns by model and service.

Args: start_time: Start time in ISO 8601 format end_time: End time in ISO 8601 format service_name: Filter by service name gen_ai_system: Filter by LLM provider gen_ai_request_model: Filter by requested model name gen_ai_response_model: Filter by actual model used limit: Maximum traces to analyze (default: 1000)

Returns: JSON string with usage metrics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
end_timeNo
start_timeNo
service_nameNo
gen_ai_systemNo
gen_ai_request_modelNo
gen_ai_response_modelNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It discloses aggregation behavior, breakdown dimensions, and that limit controls traces analyzed, which helps. However, it does not state read-only safety, permissions, pagination, or other operational constraints.

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?

The description is front-loaded with purpose, then structured into Args and Returns. It is efficient overall, though the Returns line is somewhat redundant given that an output schema exists.

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?

Given seven optional filters and no annotations, the description covers the core operation and parameter meanings. It remains incomplete for agent routing because it lacks when-to-use guidance versus siblings and does not clarify optionality/defaults beyond limit.

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 documents all seven parameters with meanings, including ISO 8601 time formats, filter semantics, and the default limit of 1000. This adds substantial value beyond the bare schema.

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?

States a specific verb and resource: 'Get aggregated LLM usage metrics (token counts) for a time period,' and adds breakdowns by model and service. It does not explicitly distinguish itself from similar siblings like get_llm_model_stats, so it falls short of a 5.

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

Usage Guidelines2/5

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

Provides no when-to-use guidance, no prerequisites, and no alternatives. It implies the tool is for usage metrics, but an agent must infer when to choose it over sibling tools such as get_llm_model_stats or get_llm_expensive_traces.

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