Skip to main content
Glama
therealsachin

Langfuse MCP Server

list_prompts

Retrieve prompt templates from Langfuse projects with filtering and pagination options to manage AI workflows.

Instructions

List all prompt templates in the Langfuse project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of prompts to return (default: 50)
pageNoPage number for pagination
nameNoFilter by prompt name (substring match)

Implementation Reference

  • The main handler function that executes the list_prompts tool logic, calling the client and formatting the response as MCP content.
    export async function listPrompts(
      client: LangfuseAnalyticsClient,
      args: ListPromptsArgs = {}
    ) {
      try {
        const promptsData = await client.listPrompts(args);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(promptsData, null, 2),
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text' as const,
              text: `Error listing prompts: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for input validation of list_prompts tool arguments.
    export const listPromptsSchema = z.object({
      limit: z.number().optional().describe('Maximum number of prompts to return (default: 50)'),
      page: z.number().optional().describe('Page number for pagination'),
      name: z.string().optional().describe('Filter by prompt name (substring match)'),
    });
    
    export type ListPromptsArgs = z.infer<typeof listPromptsSchema>;
  • src/index.ts:579-599 (registration)
    Registration of the list_prompts tool in the allTools array, including name, description, and input schema for MCP listTools request.
    {
      name: 'list_prompts',
      description: 'List all prompt templates in the Langfuse project.',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of prompts to return (default: 50)',
          },
          page: {
            type: 'number',
            description: 'Page number for pagination',
          },
          name: {
            type: 'string',
            description: 'Filter by prompt name (substring match)',
          },
        },
      },
    },
  • Helper method in LangfuseAnalyticsClient that performs the actual API call to list prompts from Langfuse backend.
    async listPrompts(params: {
      limit?: number;
      page?: number;
      name?: string;
    }): Promise<any> {
      const queryParams = new URLSearchParams();
    
      if (params.limit) queryParams.append('limit', params.limit.toString());
      if (params.page) queryParams.append('page', params.page.toString());
      if (params.name) queryParams.append('name', params.name);
    
      const authHeader = 'Basic ' + Buffer.from(
        `${this.config.publicKey}:${this.config.secretKey}`
      ).toString('base64');
    
      const response = await fetch(`${this.config.baseUrl}/api/public/v2/prompts?${queryParams}`, {
        headers: {
          'Authorization': authHeader,
        },
      });
    
      if (!response.ok) {
        await this.handleApiError(response, 'List Prompts');
      }
    
      return await response.json();
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('List all prompt templates') but lacks details on permissions, rate limits, pagination behavior (beyond what the schema implies), or response format. This is insufficient for a mutation-free tool with zero annotation coverage.

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 that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't address key aspects like what the returned data looks like, error conditions, or usage constraints. For a tool with three parameters and no structured output information, more context is needed.

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 the three parameters (limit, page, name). The description adds no additional meaning beyond what the schema provides, such as explaining filter logic or default behaviors, meeting the baseline score for high schema coverage.

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 ('all prompt templates in the Langfuse project'), making the purpose specific and understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_prompt_detail' or 'list_models', which would be needed for 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. For example, it doesn't mention when to choose 'list_prompts' over 'get_prompt_detail' or other list tools like 'list_datasets', leaving the agent without context for 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