Skip to main content
Glama

get_llm_expensive_traces

Find LLM traces with high token usage to optimize costs and identify inefficient prompts.

Instructions

Find traces with highest LLM token usage.

Useful for cost optimization and identifying inefficient prompts.

Args: limit: Maximum number of traces to return (default: 10) start_time: Start time in ISO 8601 format (e.g., 2024-01-01T00:00:00Z) end_time: End time in ISO 8601 format min_tokens: Minimum token count threshold (only return traces above this) service_name: Filter by service name gen_ai_request_model: Filter by requested model name (e.g., "gpt-4") gen_ai_response_model: Filter by actual model used (e.g., "gpt-4-0613")

Returns: JSON string with top N most expensive traces sorted by total token usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
end_timeNo
min_tokensNo
start_timeNo
service_nameNo
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

A3.6/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 the sort order (top N by total token usage) and threshold semantics, but says nothing about permissions, pagination, rate limits, or whether only LLM-instrumented traces are considered.

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 purpose, then args, then returns, with no redundancy. 'Useful for cost optimization' is mild filler but earns its place by hinting at usage.

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?

For a 7-parameter, annotation-free tool this covers each parameter acceptably, and the output schema exists so return-value detail is not required. Missing behavior-level notes (auth, default time window when start/end are omitted) keep it short of 5.

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 prose must compensate, and it does: ISO 8601 format with an example, min_tokens threshold behavior, and the request-vs-response model distinction. The only shortfall is repeating the schema's default for limit without adding new meaning.

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: 'Find traces with highest LLM token usage,' with a clear sort criterion (total token usage). However, it does not distinguish itself from near-identical siblings like get_llm_slow_traces or get_llm_usage, 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?

'Useful for cost optimization and identifying inefficient prompts' implies a use case but names no when-not conditions and no alternatives. With get_llm_slow_traces and get_llm_usage as obvious siblings, the lack of routing guidance is a real gap.

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