Skip to main content
Glama

Get LLM Usage

get_llm_usage
Read-onlyIdempotent

Retrieve aggregated token usage metrics for LLM calls within a specified time range. Filter by model, provider, or service to view token counts broken down by model and service.

Instructions

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

Provides breakdowns by model and service.

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.11.0
    • addedInput schema / properties / end_time / description
      Added value: +"End time in ISO 8601 format"
    • addedInput schema / properties / gen_ai_request_model / description
      Added value: +"Filter by requested model name"
    • addedInput schema / properties / gen_ai_response_model / description
      Added value: +"Filter by actual model used"
    • addedInput schema / properties / gen_ai_system / description
      Added value: +"Filter by LLM provider"
    • addedInput schema / properties / limit / description
      Added value: +"Maximum traces to analyze (default: 1000)"
    • addedInput schema / properties / service_name / description
      Added value: +"Filter by service name"
    • addedInput schema / properties / start_time / description
      Added value: +"Start time in ISO 8601 format"
  2. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the safety profile is covered. The description adds the time-period aggregation and breakdown context, which is useful, but does not disclose any additional behavioral traits such as how limit affects aggregation or whether empty time ranges return empty results.

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 action and scope are front-loaded, and the breakdown mention is the only supporting detail—every word earns its place.

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

Completeness4/5

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

With a full input schema, rich annotations, and an output schema, the structured context covers invocation details well. The description is sufficient for a simple read-only aggregation tool, though it would be stronger with an explicit pointer to the closest sibling tool.

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. The description's mention of time period and breakdowns does not add meaningful parameter detail beyond what the schema provides, so the baseline of 3 applies.

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 clearly states the action ('Get aggregated LLM usage metrics'), the resource ('token counts'), and the time-period scope, and adds that breakdowns by model and service are included. It is specific enough to distinguish it from trace-level siblings like get_llm_expensive_traces, though it does not explicitly contrast it with get_llm_model_stats.

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?

The description gives no guidance on when to use this tool versus the many sibling tools, no exclusions, and no alternative recommendations. With siblings like get_llm_model_stats and get_llm_expensive_traces, the agent is left to infer the intended use case.

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