Get trace with full observation tree
getTraceFetch a trace by ID, including all nested observations.
Instructions
Fetch a single trace by id including all nested observations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| traceId | Yes |
Implementation Reference
- src/tools.ts:34-42 (registration)Registration of the 'getTrace' tool on the MCP server using server.registerTool(...). It defines the tool name, title, description, input schema (traceId: string), and handler.
server.registerTool( "getTrace", { title: "Get trace with full observation tree", description: "Fetch a single trace by id including all nested observations.", inputSchema: { traceId: z.string().min(1) }, }, async ({ traceId }) => asJson(await client.get(`/api/public/traces/${enc(traceId)}`)), ); - src/tools.ts:41-41 (handler)The handler function for getTrace. It takes { traceId }, URL-encodes it, and calls client.get(`/api/public/traces/${enc(traceId)}`) to fetch a single trace including all nested observations.
async ({ traceId }) => asJson(await client.get(`/api/public/traces/${enc(traceId)}`)), - src/tools.ts:39-39 (schema)Input schema for getTrace: requires a single 'traceId' field as a non-empty string (z.string().min(1)).
inputSchema: { traceId: z.string().min(1) }, - src/tools.ts:394-394 (registration)Exported TOOL_NAMES list includes 'getTrace' as one of the registered tool names.
"getTrace", - src/tools.ts:6-10 (helper)The 'asJson' helper function used by the getTrace handler to format the API response as MCP content (JSON text).
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }); const enc = encodeURIComponent;