Skip to main content
Glama

Query Distributed Traces

query_traces
Read-onlyIdempotent

Search distributed traces (Tempo TraceQL), newest first, to find slow, failing, or specific requests. Filter with structured params (gvc, workload, location, httpMethod, requestId, errorsOnly, minDuration) OR a raw traceql query, which REPLACES them and must embed every filter. Span attributes: resource.gvc, resource.workload, resource.location, span.http.method, span.http.url (the full URL), span.http.status_code (a string, e.g. "503"), span."guid:x-request-id". Traces exist only where tracing is enabled (spec.tracing on the GVC via update_gvc, or on the org) and only for requests sampled after that. Returns trace IDs with root span, requests seen, start time, and duration. traceId returns that one trace instead: the span tree with each span's duration, service, kind (server: a request the workload received; client: a call it made), method, path, and status; the request ids to match in access and request logs; and the error spans with their messages, to pinpoint WHERE latency or failures sit. A very large trace shows its first spans in tree order and always lists its error spans.

Input Schema

NameRequiredDescriptionDefault
toNoAbsolute end time (exclusive, ISO 8601).
gvcNoFilter traces to one GVC (matches the `resource.gvc` span attribute).
orgNoOrganization slug.
fromNoAbsolute start time (inclusive, ISO 8601). Overrides `since`. Must be earlier than `to`.
limitNoMaximum traces to return (default: 20, max: 100).
sinceNoLookback window as relative duration (default: "1h"). Examples: "30m", "2h", "1d".
traceIdNoA trace ID from search results: returns that trace instead of searching.
traceqlNoRaw TraceQL, e.g. `{ resource.gvc = "prod" && span.http.url =~ ".*/checkout.*" }`. REPLACES the structured params, so it must embed every filter.
locationNoFilter traces to one location (e.g., "aws-us-east-1").
workloadNoFilter traces to one workload (matches the `resource.workload` span attribute).
requestIdNoOnly the trace of this request: the x-request-id in access and request logs.
errorsOnlyNoOnly return traces containing at least one error span.
httpMethodNoOnly traces with a request of this HTTP method, e.g. "POST".
minDurationNoOnly return traces slower than this total duration (e.g., "500ms", "2s") — the slow-request finder.

Output Schema

NameRequiredDescriptionDefault
okYes
dataNoThe full result. Read this, not only the summary.
detailsNo
summaryYes
nextStepsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / traceId
      Added value: +{
      +  "description": "A trace ID from search results: returns that trace instead of searching.",
      +  "type": "string"
      +}
  2. Changed26 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / from / maxLength
      Removed value: -40
    • removedInput schema / properties / gvc / minLength
      Removed value: -1
    • addedInput schema / properties / httpMethod
      Added value: +{
      +  "description": "Only traces with a request of this HTTP method, e.g. \"POST\".",
      +  "type": "string"
      +}
    • removedInput schema / properties / location / minLength
      Removed value: -1
    • removedInput schema / properties / minDuration / pattern
      Removed value: -"^\\d+(\\.\\d+)?(ns|us|ms|s|m|h)$"
    • changedInput schema / properties / org / description
      Previous value: -"Organization slug (lowercase kebab-case). NEVER guess — if the user has not named one, ask. On org-not-found, stop and ask; do not retry variants."New value: +"Organization slug."
    • removedInput schema / properties / org / maxLength
      Removed value: -63
    • removedInput schema / properties / org / minLength
      Removed value: -1
    • removedInput schema / properties / org / pattern
      Removed value: -"^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
    • addedInput schema / properties / requestId
      Added value: +{
      +  "description": "Only the trace of this request: the x-request-id in access and request logs.",
      +  "type": "string"
      +}
    • removedInput schema / properties / since / maxLength
      Removed value: -20
    • removedInput schema / properties / to / maxLength
      Removed value: -40
    • changedInput schema / properties / traceql / description
      Previous value: -"Raw TraceQL query (e.g. `{ resource.workload = \"api\" && status = error }`). REPLACES the structured params entirely, so it must embed ALL filters itself. Span attributes available: resource.gvc, resource.workload, resource.location."New value: +"Raw TraceQL, e.g. `{ resource.gvc = \"prod\" && span.http.url =~ \".*/checkout.*\" }`. REPLACES the structured params, so it must embed every filter."
    • removedInput schema / properties / traceql / maxLength
      Removed value: -500
    • removedInput schema / properties / traceql / minLength
      Removed value: -1
    • removedInput schema / properties / workload / minLength
      Removed value: -1
    • removedInput schema / required
      Removed value: -[
      -  "org"
      -]
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedOutput schema / additionalProperties
      Removed value: -false
    • changedOutput schema / properties / data / description
      Previous value: -"The full machine-readable result — list rows, the resource object, query results. Read THIS, not just the summary."New value: +"The full result. Read this, not only the summary."
    • addedOutput schema / properties / details
      Added value: +{
      +  "type": "string"
      +}
    • removedOutput schema / properties / nextSteps / description
      Removed value: -"Recommended follow-up actions for this task, in order."
    • removedOutput schema / properties / ok / description
      Removed value: -"Whether the call succeeded."
    • removedOutput schema / properties / summary / description
      Removed value: -"One-line summary of the result."
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare a safe, idempotent read, but the description adds substantial context: newest-first ordering, span attribute names usable in TraceQL, the sampling/tracing-enablement caveat, and truncation behavior for very large traces (first spans in tree order, error spans always listed). That is exactly the kind of behavior an agent needs before invoking.

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?

Dense but front-loaded: purpose first, then filter modes, then preconditions, then return shape. Most sentences carry unique information, though the long span-attribute enumeration and return-value recap are heavy given an output schema already exists.

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?

Covers the two call modes, filter interplay, enabling/sampling prerequisites, and truncation semantics, so an agent can call it correctly even though the output schema handles return shape. No significant gaps remain.

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, but the description adds real meaning: it maps filters to concrete span attributes (resource.gvc, span.http.status_code as a string, span."guid:x-request-id") and clarifies that `traceql` replaces and must subsume the structured params. This helps agents author correct queries beyond what the schema says.

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 specific verb and resource ("Search distributed traces (Tempo TraceQL)") and immediately distinguishes the two modes: search vs. single-trace detail via `traceId`. It is clearly separable from siblings like query_metrics and query_audit_events.

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

Usage Guidelines4/5

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

Gives clear use cases (slow, failing, or specific requests) and a critical precondition: traces only exist where `spec.tracing` is enabled and only for requests sampled after that. It also states the `traceql`-vs-structured-params rule. It doesn't explicitly name sibling alternatives for non-trace questions, keeping it just shy of a 5.

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.