Skip to main content
Glama

Query Spans

spans
Read-onlyIdempotent

Find individual spans matching filter criteria within a time range.

This is a DRILL-DOWN tool. For "where are errors / latency concentrated?" start with aggregate_spans, then use this to fetch example spans for a (service, operation).

Returns spans sorted by (timestamp, spanId) descending (newest first).

Returns the span's core fields by default; pass verbose=true to include its attributes (flattened in, plus a resource object). Long string values are capped (maxStringChars). For raw columns or custom selection use run_sql.

Defaults: from is 1 hour before to (or before now) when omitted — set it to read further back; to is now when omitted; limit 100 (max 1000); all filters any. Common patterns:

  • Errored spans of an operation: statusCode="ERROR", name="http.client"

  • Slow spans: minDurationMs=500

  • Every span of a trace: traceId="..." (or use get_trace)

A span is viewed in the context of its trace. To show one to the user, call get_trace with its traceId and hand them traceUrl, which opens the trace as a waterfall in the Fixter app, rather than drawing the span yourself.

Returns: spans[], nextCursor (null on last page), queryStats, and truncationHint when the page was cut to fit the response (nextCursor then reads on from the last span shown).

Input Schema

NameRequiredDescriptionDefault
toNoEnd of window, ISO-8601 instant (exclusive); now when omitted
fromNoStart of window, ISO-8601 instant (inclusive); 1 hour before to (or now) when omitted
kindNoFilter by kind: SERVER, CLIENT, PRODUCER, CONSUMER, INTERNAL
nameNoFilter by operation/span name (e.g. 'GET /things')
limitNoMax spans, default 100, max 1000
cursorNoOpaque cursor from a previous next_cursor
serviceNoFilter by service name
traceIdNoFilter to a single trace id
verboseNoReturn full spans incl. attributes and resource. Default false.
statusCodeNoFilter by status: UNSET, OK, ERROR
minDurationMsNoOnly spans at least this many milliseconds long
maxStringCharsNoMax characters of any attribute string value before truncation, at most 4000. Omit to use the server default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / from / description
      Previous value: -"Start of window, ISO-8601 instant (inclusive)"New value: +"Start of window, ISO-8601 instant (inclusive); 1 hour before to (or now) when omitted"
    • changedInput schema / properties / to / description
      Previous value: -"End of window, ISO-8601 instant (exclusive)"New value: +"End of window, ISO-8601 instant (exclusive); now when omitted"
  2. Changed1 schema field changed
    • changedInput schema / properties / maxStringChars / description
      Previous value: -"Max characters of any attribute string value before truncation. Omit to use the server default."New value: +"Max characters of any attribute string value before truncation, at most 4000. Omit to use the server default."
  3. Changed5 schema fields changed
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / limit / format
      Added value: +"int32"
    • addedInput schema / properties / maxStringChars / format
      Added value: +"int32"
    • addedInput schema / properties / minDurationMs / format
      Added value: +"int32"
  4. Added
  5. Removed
  6. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description still adds substantial behavioral detail beyond them: sort order (timestamp, spanId descending), default window and limit values, max limit, verbose expanding attributes plus a resource object, string capping via maxStringChars, and truncationHint/nextCursor pagination semantics.

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-loaded with the purpose and the drill-down routing, then a scannable pattern list and a returns line. It is on the long side and the defaults paragraph partially duplicates the schema, but nearly every sentence carries actionable routing or behavioral information.

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?

With no output schema, the description compensates by documenting the return shape (spans[], nextCursor, queryStats, truncationHint) and how truncation interacts with pagination. Combined with the get_trace guidance for presenting a span, an agent has everything needed to call and use the result correctly.

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 would be 3, but the description adds real meaning: it restates the from/to defaults and limit bounds in context, and explains that verbose flattens attributes in plus a resource object — semantics the schema's terse 'full spans incl. attributes and resource' only gestures at. Filter combination behavior ('all filters any') is also clarified.

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?

Opens with a specific verb+resource: 'Find individual spans matching filter criteria within a time range.' It then explicitly positions itself against siblings by labeling itself a DRILL-DOWN tool relative to aggregate_spans, and points to get_trace and run_sql for adjacent needs.

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?

Explicit when-to-use routing: start with aggregate_spans for 'where are errors / latency concentrated?', then drill down here for example spans of a (service, operation). It adds concrete invocation patterns (statusCode="ERROR", minDurationMs=500, traceId=...) and names alternatives (get_trace, run_sql) with the conditions that select them.

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