Skip to main content
Glama

List traces

listTraces

Retrieve a paginated list of Langfuse traces with optional filters like user ID, session, name, tags, and time range. Returns summary metadata for each trace.

Instructions

List Langfuse traces with filters. Returns summary metadata (use getTrace for the full observation tree).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (default 1)
limitNoItems per page (default 50, max 100)
fromTimestampNoISO 8601 lower bound (inclusive)
toTimestampNoISO 8601 upper bound (exclusive)
userIdNo
sessionIdNo
nameNoExact trace name match
environmentNo
tagsNo
orderByNoe.g. 'timestamp.desc' (default)

Implementation Reference

  • src/tools.ts:14-32 (registration)
    Registration of the 'listTraces' tool via server.registerTool with its name, metadata, inputSchema, and handler.
    server.registerTool(
      "listTraces",
      {
        title: "List traces",
        description:
          "List Langfuse traces with filters. Returns summary metadata (use getTrace for the full observation tree).",
        inputSchema: {
          ...paginationShape,
          ...timeRangeShape,
          userId: z.string().optional(),
          sessionId: z.string().optional(),
          name: z.string().optional().describe("Exact trace name match"),
          environment: z.string().optional(),
          tags: z.array(z.string()).optional(),
          orderBy: z.string().optional().describe("e.g. 'timestamp.desc' (default)"),
        },
      },
      async (args) => asJson(await client.get("/api/public/traces", args)),
    );
  • The handler function that executes the listTraces tool logic: calls client.get('/api/public/traces', args) and wraps the result in JSON content.
    async (args) => asJson(await client.get("/api/public/traces", args)),
  • Input schema for listTraces, using paginationShape, timeRangeShape, and optional filters (userId, sessionId, name, environment, tags, orderBy).
    inputSchema: {
      ...paginationShape,
      ...timeRangeShape,
      userId: z.string().optional(),
      sessionId: z.string().optional(),
      name: z.string().optional().describe("Exact trace name match"),
      environment: z.string().optional(),
      tags: z.array(z.string()).optional(),
      orderBy: z.string().optional().describe("e.g. 'timestamp.desc' (default)"),
    },
  • Imported shared schema shapes used by listTraces: paginationShape (page, limit) and timeRangeShape (fromTimestamp, toTimestamp).
    import type { LangfuseClient } from "./client.js";
    import { paginationShape, timeRangeShape } from "./schemas.js";
    
    const asJson = (data: unknown) => ({
      content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
    });
    
    const enc = encodeURIComponent;
    
    export function registerTools(server: McpServer, client: LangfuseClient): void {
  • Definition of paginationShape and timeRangeShape used as input schema building blocks for listTraces.
    export const paginationShape = {
      page: z.number().int().positive().optional().describe("Page number (default 1)"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Items per page (default 50, max 100)"),
    };
    
    export const timeRangeShape = {
      fromTimestamp: z.string().datetime().optional().describe("ISO 8601 lower bound (inclusive)"),
      toTimestamp: z.string().datetime().optional().describe("ISO 8601 upper bound (exclusive)"),
    };
Behavior3/5

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

No annotations are present, so the description carries the burden. It discloses that only summary metadata is returned, but does not mention rate limits, ordering, or read-only nature.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with two sentences, front-loading the verb 'list' and providing a clear alternative reference.

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

Completeness2/5

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

For a tool with 10 parameters, no output schema, and no annotations, the description is too minimal, omitting usage examples, filter explanations, and pagination details.

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

Parameters2/5

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

With 60% schema description coverage, the description adds no additional parameter context beyond the schema, failing to compensate for the missing param descriptions.

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 the tool lists Langfuse traces with filters and specifies that it returns summary metadata, distinguishing it from getTrace for full observation trees.

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

Usage Guidelines4/5

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

The description mentions an alternative tool (getTrace) for full detail, giving context on when to use each, but lacks explicit when-not or other scenarios.

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/hugoles/langfuse-mcp'

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