List scores
listScoresRetrieve scores with filters for page, user, name, trace, and time range. Use to query specific score data from Langfuse.
Instructions
List scores with filters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default 1) | |
| limit | No | Items per page (default 50, max 100) | |
| userId | No | ||
| name | No | ||
| traceId | No | ||
| fromTimestamp | No | ||
| toTimestamp | No |
Implementation Reference
- src/tools.ts:102-118 (registration)Registration of the 'listScores' tool via server.registerTool(), including input schema (pagination, userId, name, traceId, fromTimestamp, toTimestamp) and a handler that calls client.get('/api/public/scores', args).
// ---------- Scores ---------- server.registerTool( "listScores", { title: "List scores", description: "List scores with filters.", inputSchema: { ...paginationShape, userId: z.string().optional(), name: z.string().optional(), traceId: z.string().optional(), fromTimestamp: z.string().datetime().optional(), toTimestamp: z.string().datetime().optional(), }, }, async (args) => asJson(await client.get("/api/public/scores", args)), ); - src/tools.ts:117-117 (handler)Handler function for listScores: async (args) => asJson(await client.get('/api/public/scores', args)). Delegates to the LangfuseClient HTTP GET method.
async (args) => asJson(await client.get("/api/public/scores", args)), - src/tools.ts:108-115 (schema)Input schema for listScores: spreads paginationShape (page, limit) and adds optional filters: userId, name, traceId, fromTimestamp, toTimestamp.
inputSchema: { ...paginationShape, userId: z.string().optional(), name: z.string().optional(), traceId: z.string().optional(), fromTimestamp: z.string().datetime().optional(), toTimestamp: z.string().datetime().optional(), }, - src/tools.ts:6-8 (helper)Helper function asJson() used by the handler to wrap API response data into MCP text content format.
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], });