Skip to main content
Glama

aggregate_calls

Aggregate LLM call data by provider, model, time period, tag, or error, computing metrics like cost, latency, tokens, count, and error rate.

Instructions

Get an aggregation cube over calls (POST /v1/query/aggregate). groupBy (provider / model / day / hour / minute / tag / error) x metric (cost / latency / tokens / input_tokens / output_tokens / cached_tokens / cache_savings / count / error_rate) — e.g. "aggregate this month's cost by model" in one call. tag mode requires tagKey (alphanumerics plus _ - only, e.g. 'env' / 'feature'). error mode aggregates only error rows by error string (which errors, how many; metric=count recommended). hour mode caps at 168h / minute mode at 60min (400 beyond). cost = SUM(cost_usd) / latency = AVG(latency_ms) / tokens = SUM(total_tokens) / input_tokens = SUM(prompt_tokens) / output_tokens = SUM(completion_tokens) / cached_tokens = SUM(cached_read_tokens) / cache_savings = SUM(cache_savings_usd) / count = COUNT(*) / error_rate = errors / total. Returns { groups: [{key, value, count}], total: {value, count} }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricNoMetric kind ('cost' / 'latency' / 'tokens' / 'input_tokens' / 'output_tokens' / 'cached_tokens' / 'cache_savings' / 'reasoning_tokens' / 'audio_tokens' / 'ttft' / 'count' / 'error_rate'), default = 'cost'. cached_tokens = SUM(cached_read_tokens), cache_savings = SUM(cache_savings_usd) (prompt-cache savings), reasoning_tokens = SUM(reasoning tokens), audio_tokens = SUM(audio tokens), ttft = AVG(ms to first token)cost
tagKeyNoRequired when groupBy='tag'. Key name inside the tags JSON (alphanumerics plus _- only, 1-64 chars)
endTimeNoRange end ISO timestamp (UTC; omit = now)
groupByNoAggregation axis ('provider' / 'model' / 'day' / 'hour' / 'minute' / 'tag' / 'error'), default = 'provider'. hour caps at 168h / minute at 60min. error aggregates only error rows by kindprovider
providerNoProvider filter ('openai' / 'anthropic' etc.); omit = all providers
startTimeNoRange start ISO timestamp (UTC; omit = all time)
Behavior5/5

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

The description fully discloses behavioral traits: limits on hour/minute modes (168h, 60min), required tagKey pattern, error mode behavior, and exact formulas for each metric. It also describes the return format. Since no annotations are present, this burden is met excellently.

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?

The description is concise yet comprehensive: it opens with the core purpose, then systematically covers dimensions, special modes, metric definitions, and output format. Every sentence adds value, and the structure is front-loaded and logical.

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?

Given the tool's complexity (6 parameters, no output schema, no annotations), the description is remarkably complete. It covers purpose, usage example, constraints, metric semantics, and output shape. Only missing explicit sibling comparisons, but these are covered by purpose clarity.

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 coverage is 100%, so baseline is 3. The description adds significant value beyond schema by explaining metric formulas (e.g., cost = SUM(cost_usd)), caps for hour/minute, tagKey requirements, and return structure. This exceeds the baseline.

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?

The description clearly states the tool computes an aggregation cube over calls, specifying groupBy dimensions and metrics with concrete examples. It distinguishes itself from siblings like query_calls or get_cost_summary by focusing on multi-dimensional aggregation.

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?

While the description provides a usage example ('aggregate this month's cost by model'), it does not explicitly state when to use this tool versus alternatives such as query_calls, get_cost_summary, or get_percentiles. The guidance is implied but not precise.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/argosvix/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server