Skip to main content
Glama
therealsachin

Langfuse MCP Server

get_observation_detail

Retrieve detailed information about a specific observation by its ID to analyze performance metrics and usage data within Langfuse projects.

Instructions

Get detailed information about a specific observation by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationIdYesThe observation ID to retrieve detailed information for

Implementation Reference

  • Core handler function that fetches the observation detail using the Langfuse client and returns formatted content or error.
    export async function getObservationDetail(
      client: LangfuseAnalyticsClient,
      args: GetObservationDetailArgs
    ) {
      try {
        const observationData = await client.getObservation(args.observationId);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(observationData, null, 2),
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text' as const,
              text: `Error getting observation detail: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for input validation of the get_observation_detail tool.
    export const getObservationDetailSchema = z.object({
      observationId: z.string().describe('The observation ID to retrieve detailed information for'),
    });
  • src/index.ts:526-539 (registration)
    Tool definition in the allTools array used by listTools handler to expose the tool with its schema.
    {
      name: 'get_observation_detail',
      description: 'Get detailed information about a specific observation by ID.',
      inputSchema: {
        type: 'object',
        properties: {
          observationId: {
            type: 'string',
            description: 'The observation ID to retrieve detailed information for',
          },
        },
        required: ['observationId'],
      },
    },
  • src/index.ts:1062-1065 (registration)
    Dispatch case in the central CallToolRequestSchema handler that parses arguments and invokes the tool handler.
    case 'get_observation_detail': {
      const args = getObservationDetailSchema.parse(request.params.arguments);
      return await getObservationDetail(this.client, args);
    }
  • TypeScript type inferred from the Zod schema for type safety.
    export type GetObservationDetailArgs = z.infer<typeof getObservationDetailSchema>;

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-server'

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