List dataset items
listDatasetItemsList dataset items including inputs, expected outputs, and metadata. Supports pagination and filtering by dataset name or source identifiers.
Instructions
List items in a dataset (inputs / expected outputs / metadata).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default 1) | |
| limit | No | Items per page (default 50, max 100) | |
| datasetName | No | Filter by dataset name | |
| sourceTraceId | No | ||
| sourceObservationId | No |
Implementation Reference
- src/tools.ts:228-229 (handler)The handler function executed when the 'listDatasetItems' tool is called. It makes a GET request to the Langfuse API endpoint '/api/public/dataset-items' with the provided arguments (pagination, datasetName, sourceTraceId, sourceObservationId).
async (args) => asJson(await client.get("/api/public/dataset-items", args)), ); - src/tools.ts:216-229 (registration)Registration of the 'listDatasetItems' tool on the MCP server, including its title 'List dataset items', description, and input schema with pagination and optional filters (datasetName, sourceTraceId, sourceObservationId).
server.registerTool( "listDatasetItems", { title: "List dataset items", description: "List items in a dataset (inputs / expected outputs / metadata).", inputSchema: { ...paginationShape, datasetName: z.string().optional().describe("Filter by dataset name"), sourceTraceId: z.string().optional(), sourceObservationId: z.string().optional(), }, }, async (args) => asJson(await client.get("/api/public/dataset-items", args)), ); - src/tools.ts:221-226 (schema)Input schema for listDatasetItems, defining filters: pagination (page, limit), datasetName, sourceTraceId, and sourceObservationId.
inputSchema: { ...paginationShape, datasetName: z.string().optional().describe("Filter by dataset name"), sourceTraceId: z.string().optional(), sourceObservationId: z.string().optional(), }, - src/tools.ts:6-8 (helper)Helper function 'asJson' used by the handler to format the API response as JSON text content blocks for the MCP response.
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }); - src/schemas.ts:3-12 (helper)The pagination shape schema reused by listDatasetItems, defining 'page' and 'limit' parameters.
export const paginationShape = { page: z.number().int().positive().optional().describe("Page number (default 1)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Items per page (default 50, max 100)"), };