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
| Name | Required | Description | Default |
|---|---|---|---|
| observationId | Yes | The observation ID to retrieve detailed information for |
Input Schema (JSON Schema)
{
"properties": {
"observationId": {
"description": "The observation ID to retrieve detailed information for",
"type": "string"
}
},
"required": [
"observationId"
],
"type": "object"
}
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>;