Skip to main content
Glama

Get Traces

get_traces

Query 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
NameRequiredDescriptionDefault
agent_nameNoFilter by agent name
frameworkNoFilter by framework
sinceNoISO timestamp lower bound
untilNoISO timestamp upper bound
min_scoreNoMinimum eval score filter
max_scoreNoMaximum eval score filter
limitNoResults per page
offsetNoPagination offset
sort_byNoSort fieldtimestamp
sort_orderNoSort orderdesc
include_summaryNoInclude dashboard summary stats

Implementation Reference

  • 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),
            },
          ],
        };
      },
    );
  • 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'),
    };
  • 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,
        },

Tool Definition Quality

Score is being calculated. Check back soon.

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/iris-eval/mcp-server'

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