Skip to main content
Glama

query_traces

Search recent traces from AgentGuard-instrumented agents using filters for service name, time range, and pagination.

Instructions

Search recent traces from your AgentGuard-instrumented agents. Filter by service name, time range, or paginate through results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax traces to return (default 20, max 500)
offsetNoOffset for pagination
serviceNoFilter by service name
sinceNoISO timestamp — only traces after this time
untilNoISO timestamp — only traces before this time

Implementation Reference

  • The handler function for the 'query_traces' tool. Calls client.getTraces() with optional filter parameters and returns the JSON-stringified result.
    handler: async (client, args) => {
      const result = await client.getTraces({
        limit: args.limit ? String(args.limit) : "20",
        offset: args.offset ? String(args.offset) : undefined,
        service: args.service as string | undefined,
        since: args.since as string | undefined,
        until: args.until as string | undefined,
      });
      return JSON.stringify(result, null, 2);
    },
  • Input schema for the 'query_traces' tool, defining optional parameters: limit, offset, service, since, until.
    inputSchema: {
      type: "object",
      properties: {
        limit: { type: "number", description: "Max traces to return (default 20, max 500)" },
        offset: { type: "number", description: "Offset for pagination" },
        service: { type: "string", description: "Filter by service name" },
        since: { type: "string", description: "ISO timestamp — only traces after this time" },
        until: { type: "string", description: "ISO timestamp — only traces before this time" },
      },
    },
  • Registration of 'query_traces' as a ToolDefinition in the tools array, with name and description.
    {
      name: "query_traces",
      description:
        "Search recent traces from your AgentGuard-instrumented agents. " +
        "Filter by service name, time range, or paginate through results.",
      inputSchema: {
        type: "object",
        properties: {
          limit: { type: "number", description: "Max traces to return (default 20, max 500)" },
          offset: { type: "number", description: "Offset for pagination" },
          service: { type: "string", description: "Filter by service name" },
          since: { type: "string", description: "ISO timestamp — only traces after this time" },
          until: { type: "string", description: "ISO timestamp — only traces before this time" },
        },
      },
      handler: async (client, args) => {
        const result = await client.getTraces({
          limit: args.limit ? String(args.limit) : "20",
          offset: args.offset ? String(args.offset) : undefined,
          service: args.service as string | undefined,
          since: args.since as string | undefined,
          until: args.until as string | undefined,
        });
        return JSON.stringify(result, null, 2);
      },
    },
  • The getTraces helper method on AgentGuardClient that makes the HTTP GET request to /api/v1/traces with optional query params.
    async getTraces(opts?: {
      limit?: string;
      offset?: string;
      service?: string;
      since?: string;
      until?: string;
    }) {
      return this.fetch<{ traces: unknown[] }>("/api/v1/traces", opts);
    }
Behavior2/5

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

No annotations provided, so description carries full burden. It mentions 'recent' without defining the time window, and doesn't disclose that the operation is read-only or any other behavioral traits (e.g., ordering, data retention).

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?

Single sentence, clear and front-loaded with the core purpose. Efficient but could be slightly more structured with separate clauses.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 5 optional parameters, no output schema, and no annotations, description lacks details on default behavior, ordering, and expected output structure. Does not clarify if it returns a list or single result, though implied.

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 description adds little beyond what the schema already provides. It lists filter types (service, time range, pagination) but no additional context on parameter usage or constraints beyond schema.

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?

Description clearly states it searches recent traces from AgentGuard-instrumented agents, with specific filtering options (service, time, pagination). This distinguishes it from sibling 'get_trace' which presumably retrieves a single trace.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool vs siblings like 'get_trace' or 'get_trace_decisions'. Context implies for listing, but no when-to-use or when-not-to-use alternatives provided.

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/bmdhodl/agent47'

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