Skip to main content
Glama
therealsachin

Langfuse MCP Server

list_comments

Retrieve and filter comments on Langfuse objects like traces, observations, sessions, or prompts by object type, ID, or author to analyze feedback and discussions.

Instructions

List comments with filtering options for objects and users.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (starts at 1)
limitNoMaximum number of comments to return (max 100)
objectTypeNoFilter comments by object type
objectIdNoFilter comments by specific object ID
authorUserIdNoFilter comments by author user ID

Implementation Reference

  • The main handler function for the 'list_comments' MCP tool. It calls the Langfuse client to fetch comments and returns a formatted JSON response or error.
    export async function listComments(
      client: LangfuseAnalyticsClient,
      args: ListCommentsArgs
    ) {
      try {
        const data = await client.listComments(args);
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
        };
      } catch (error: any) {
        return {
          content: [{ type: 'text' as const, text: `Error listing comments: ${error.message}` }],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the list_comments tool, used for validation in the handler.
    export const listCommentsSchema = z.object({
      page: z.number().int().positive().optional().describe('Page number for pagination (starts at 1)'),
      limit: z.number().int().min(1).max(100).optional().describe('Maximum number of comments to return (max 100)'),
      objectType: z.enum(['trace', 'observation', 'session', 'prompt']).optional().describe('Filter comments by object type'),
      objectId: z.string().optional().describe('Filter comments by specific object ID'),
      authorUserId: z.string().optional().describe('Filter comments by author user ID'),
    });
  • src/index.ts:804-835 (registration)
    Tool definition registered in the server's listTools handler, providing name, description, and JSON Schema for MCP protocol compliance.
    {
      name: 'list_comments',
      description: 'List comments with filtering options for objects and users.',
      inputSchema: {
        type: 'object',
        properties: {
          page: {
            type: 'number',
            description: 'Page number for pagination (starts at 1)',
          },
          limit: {
            type: 'number',
            minimum: 1,
            maximum: 100,
            description: 'Maximum number of comments to return (max 100)',
          },
          objectType: {
            type: 'string',
            enum: ['trace', 'observation', 'session', 'prompt'],
            description: 'Filter comments by object type',
          },
          objectId: {
            type: 'string',
            description: 'Filter comments by specific object ID',
          },
          authorUserId: {
            type: 'string',
            description: 'Filter comments by author user ID',
          },
        },
      },
    },
  • src/index.ts:1136-1139 (registration)
    Switch case in the callToolRequestSchema handler that dispatches list_comments tool calls by parsing arguments with the Zod schema and invoking the handler function.
    case 'list_comments': {
      const args = listCommentsSchema.parse(request.params.arguments);
      return await listComments(this.client, args);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions filtering but doesn't describe key behaviors like pagination handling, rate limits, authentication needs, or what happens with invalid filters. For a read operation with 5 parameters, this is insufficient to guide safe and effective use.

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 a single, efficient sentence with zero waste. It's front-loaded with the core purpose and includes essential context about filtering. Every word earns its place, making it highly concise and well-structured.

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?

Given the complexity of 5 parameters, no annotations, and no output schema, the description is incomplete. It lacks behavioral details (e.g., pagination, error handling), usage context, and output expectations. For a list tool with filtering, this leaves significant gaps for an AI agent to operate effectively.

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 description coverage is 100%, so the schema fully documents all 5 parameters. The description adds marginal value by hinting at filtering for 'objects and users', which loosely maps to 'objectType', 'objectId', and 'authorUserId', but doesn't provide additional syntax or usage details beyond what the schema already specifies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and resource 'comments', specifying the action and target. It adds value by mentioning 'filtering options for objects and users', which distinguishes it from a simple unfiltered list. However, it doesn't explicitly differentiate from sibling tools like 'get_comment' or other list tools, keeping it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_comment' for single comments or other list tools for different resources, nor does it specify prerequisites or exclusions. This leaves the agent without context for tool selection.

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

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