Skip to main content
Glama
respanai

Respan MCP Server

Official
by respanai

get_trace_tree

Retrieve the complete hierarchical span tree of a trace to examine nested spans, parent-child relationships, inputs, outputs, latency, and token usage.

Instructions

Retrieve the complete hierarchical span tree of a single trace.

Returns detailed trace information with the full span_tree structure showing:

  • All spans in the trace with parent-child relationships

  • Full input/output for each span

  • Timing and performance metrics per span

  • Model and token usage per LLM span

  • Nested children spans forming the execution tree

TRACE FIELDS:

  • trace_unique_id: Unique identifier

  • start_time, end_time: Trace time range

  • duration: Total duration in seconds

  • span_count: Total number of spans

  • llm_call_count: Number of LLM calls

  • total_prompt_tokens, total_completion_tokens, total_tokens: Aggregate token usage

  • total_cost: Total cost in USD

  • error_count: Number of errors

  • metadata: Custom metadata object

  • customer_identifier: User identifier

  • environment: Environment name

SPAN TREE STRUCTURE: Each span in span_tree contains:

  • span_unique_id: Unique span identifier

  • span_name: Name of the operation

  • span_parent_id: Parent span ID (null for root)

  • log_type: Span type (CHAT, COMPLETION, FUNCTION, TASK, WORKFLOW, etc.)

  • start_time, timestamp: Span timing

  • latency: Duration in seconds

  • input: Full span input data

  • output: Full span output data

  • model: Model used (for LLM spans)

  • prompt_tokens, completion_tokens: Token counts

  • cost: Cost in USD

  • status: Status (success, error)

  • status_code: HTTP-like status code

  • children: Array of nested child spans

Use list_traces first to find trace_unique_id, then use this for full span tree.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_timeNoEnd time filter in ISO 8601 format
trace_idYesTrace unique ID (trace_unique_id field from list_traces)
start_timeNoStart time filter in ISO 8601 format
environmentNoEnvironment filter (if trace exists in multiple environments)
Behavior5/5

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

With no annotations provided, the description carries full burden. It thoroughly discloses the output structure, including all trace fields and span tree fields, and even mentions 'Nested children spans forming the execution tree.' It implies a read-only operation (no side effects) and does not contradict any annotation (since none exist). The level of detail for a complex output is exceptional.

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?

The description is lengthy (multiple sections) but well-structured with headers and bullet points. The first sentence immediately states the purpose, and each subsequent section (trace fields, span tree structure, usage hint) adds necessary detail for a complex output. While not concise, the structure justifies the length, and every sentence contributes value.

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 (returns a full hierarchical span tree with many fields) and the absence of an output schema, the description provides an exhaustive list of fields and structure, ensuring the agent knows exactly what to expect. It also includes usage context (list_traces first). No critical information appears missing, making it fully complete for this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so each parameter is already described (e.g., trace_id: 'Trace unique ID (trace_unique_id field from list_traces)'). The description adds minimal parameter-specific meaning beyond the schema—it only reinforces the prerequisite for trace_id. It does not elaborate on start_time/end_time or environment filters. Per the rubric, high schema coverage yields a baseline of 3, which is appropriate here.

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 'Retrieve the complete hierarchical span tree of a single trace.' This is a specific verb+resource (retrieve + span tree) that distinguishes it from siblings like list_traces (list traces) and get_spans_summary (summary), and it explicitly mentions hierarchical structure, making the purpose unambiguous.

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?

The description explicitly instructs, 'Use list_traces first to find trace_unique_id, then use this for full span tree.' This provides a clear workflow and prerequisite, and the mention of list_traces as the predecessor helps the agent understand when to invoke this tool. No alternatives are needed since this is the dedicated span-tree retrieval tool.

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/respanai/respan-mcp'

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