Get Traces
get_tracesQuery stored agent evaluation traces with filters for agent name, framework, score, time range, and optional summary statistics. Supports pagination and sorting by timestamp, latency, or cost.
Instructions
Query stored traces with filters, pagination, and optional summary stats
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_name | No | Filter by agent name | |
| framework | No | Filter by framework | |
| since | No | ISO timestamp lower bound | |
| until | No | ISO timestamp upper bound | |
| min_score | No | Minimum eval score filter | |
| max_score | No | Maximum eval score filter | |
| limit | No | Results per page | |
| offset | No | Pagination offset | |
| sort_by | No | Sort field | timestamp |
| sort_order | No | Sort order | desc |
| include_summary | No | Include dashboard summary stats |
Implementation Reference
- src/tools/get-traces.ts:27-63 (handler)The tool handler implementation for "get_traces". It calls `storage.queryTraces` with the provided arguments and optionally fetches a dashboard summary.
async (args) => { const result = await storage.queryTraces({ filter: { agent_name: args.agent_name, framework: args.framework, since: args.since, until: args.until, min_score: args.min_score, max_score: args.max_score, }, limit: args.limit, offset: args.offset, sort_by: args.sort_by as 'timestamp' | 'latency_ms' | 'cost_usd', sort_order: args.sort_order as 'asc' | 'desc', }); const response: Record<string, unknown> = { traces: result.traces, total: result.total, limit: result.limit, offset: result.offset, }; if (args.include_summary) { response.summary = await storage.getDashboardSummary(); } return { content: [ { type: 'text' as const, text: JSON.stringify(response), }, ], }; }, ); - src/tools/get-traces.ts:5-17 (schema)The input validation schema using Zod for the "get_traces" tool.
const inputSchema = { agent_name: z.string().optional().describe('Filter by agent name'), framework: z.string().optional().describe('Filter by framework'), since: z.string().optional().describe('ISO timestamp lower bound'), until: z.string().optional().describe('ISO timestamp upper bound'), min_score: z.number().optional().describe('Minimum eval score filter'), max_score: z.number().optional().describe('Maximum eval score filter'), limit: z.number().default(50).describe('Results per page'), offset: z.number().default(0).describe('Pagination offset'), sort_by: z.enum(['timestamp', 'latency_ms', 'cost_usd']).default('timestamp').describe('Sort field'), sort_order: z.enum(['asc', 'desc']).default('desc').describe('Sort order'), include_summary: z.boolean().default(false).describe('Include dashboard summary stats'), }; - src/tools/get-traces.ts:19-26 (registration)Registration function for the "get_traces" tool, linking the tool name to its handler and schema on the McpServer.
export function registerGetTracesTool(server: McpServer, storage: IStorageAdapter): void { server.registerTool( 'get_traces', { title: 'Get Traces', description: 'Query stored traces with filters, pagination, and optional summary stats', inputSchema, },