Skip to main content
Glama

aggregate_spans

Aggregate spans into RED metrics: request count, error rate, throughput, and latency percentiles (p50/p90/p95/p99), grouped by operation and optionally its immediate parent.

START HERE for "where are errors / latency concentrated?", "what changed between two windows?", "is this operation slow?". By default this reads a pre-aggregated rollup, so it stays cheap over wide windows: minute resolution for the last 45 days, hourly beyond that (up to 400 days). Drill into raw spans (spans / get_trace) once this points you at a specific (service, operation).

Parent breakdown: the same operation behaves differently per caller. Add "parent_operation" to groupBy to split an operation by its immediate parent — e.g. "http.client" might be 8% errors overall but 92% under one caller and 0% under others. The parent breakdown is computed on demand over raw spans, so keep it scoped: pass a tight from/to and a service/name filter when using it.

Params: from, to: ISO-8601 window (required). step: "", units s m h d w mo y (e.g. "30s", "15m", "2h", "1d", "1w", "1mo", "1y") — omit for a single window per group. groupBy: any of service, operation, parent_operation (default service, operation). service / name: optional filters.

Returns buckets[], each with group, spanCount/okCount/errorCount/unsetCount, errorRate (percentage, 0-100), throughputPerSecond, avg/min/maxDurationNanos, and quantileNanos (p50/p90/p95/p99), plus queryStats, and truncatedRows + truncationHint when buckets were dropped from the end to fit maxChars.

With a step, every bucket of the window is present for every group the result mentions: a bucket with no spans comes back with spanCount 0, so a series that stopped ends in empty buckets rather than on its last populated one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesEnd of window, ISO-8601 instant (exclusive)
fromYesStart of window, ISO-8601 instant (inclusive)
nameNoFilter by operation name
stepNoTime bucket <amount><unit>, units: s m h d w mo y (e.g. 30s, 15m, 2h, 1d, 1w, 1mo, 1y); omit for one window
groupByNoGroup-by keys: service, operation, parent_operation
serviceNoFilter by service
maxCharsNoCharacter budget for the whole response; buckets are dropped from the end to fit and truncatedRows says how many. Omit for the server ceiling.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description fully carries the behavioral burden and does so richly: it reveals the default reads a pre-aggregated rollup with specific resolution/retention (minute vs hourly, up to 400 days), that parent_operation is computed on demand over raw spans, and that truncation and zero-filled buckets occur under maxChars/step. It also clearly implies a read-only operation by describing reads and computations.

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 long but intentionally organized: purpose and use-case triggers are front-loaded, the parent_operation caveat appears early, and params/results are in compact labeled blocks. Every sentence conveys either a use decision, a performance characteristic, or a return-field fact; there is no filler.

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?

For a 7-parameter tool with no annotations and no output schema, the description is comprehensive: it covers all parameters through the schema and the Params block, documents the full return shape (buckets fields, errorRate scale, quantileNanos, queryStats, truncation fields), and explains the zero-fill behavior. An agent has enough to choose and call the tool correctly and interpret results.

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 the baseline is 3, and the description adds useful meaning beyond the schema: it documents the default groupBy ('service, operation'), gives concrete step examples, clarifies from/to as an ISO-8601 required window, and explains the behavioral effect of the parent_operation group key. It does not need to repeat every property, but the added semantics justify a 4.

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?

States a precise verb ('Aggregate spans') and a specific resource: RED metrics including request count, error rate, throughput, and latency percentiles, grouped by service/operation/parent_operation. It also distinguishes itself by pointing to raw spans tools ('spans / get_trace') for drill-down, so an agent can immediately tell it from siblings.

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

Usage Guidelines5/5

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

Gives explicit start-here triggers for common questions ('where are errors / latency concentrated?', 'what changed between two windows?') and names alternatives: use spans/get_trace once pointed at a specific service/operation. It also warns to keep the on-demand parent breakdown scoped with a tight window and filters.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources