get_dataset
Retrieve detailed information about a specific dataset by name to analyze Langfuse analytics, cost metrics, and usage data across projects.
Instructions
Get detailed information about a specific dataset by name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| datasetName | Yes | Name of the dataset to retrieve |
Input Schema (JSON Schema)
{
"properties": {
"datasetName": {
"description": "Name of the dataset to retrieve",
"type": "string"
}
},
"required": [
"datasetName"
],
"type": "object"
}
Implementation Reference
- src/tools/get-dataset.ts:10-26 (handler)The main async handler function that implements the core logic of the 'get_dataset' tool. It fetches the dataset from the Langfuse client using the provided datasetName and returns formatted JSON content or an error response.export async function getDataset( client: LangfuseAnalyticsClient, args: GetDatasetArgs ) { try { const data = await client.getDataset(args.datasetName); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text' as const, text: `Error: ${errorMessage}` }], isError: true, }; } }
- src/tools/get-dataset.ts:4-6 (schema)Zod schema defining the input parameters for the 'get_dataset' tool, specifically requiring a non-empty datasetName string.export const getDatasetSchema = z.object({ datasetName: z.string().min(1).describe('Name of the dataset to retrieve'), });
- src/index.ts:662-675 (registration)Tool registration in the allTools array used by listToolsRequestHandler. Defines the tool's name, description, and input schema for MCP protocol advertisement.{ name: 'get_dataset', description: 'Get detailed information about a specific dataset by name.', inputSchema: { type: 'object', properties: { datasetName: { type: 'string', description: 'Name of the dataset to retrieve', }, }, required: ['datasetName'], }, },
- src/index.ts:1103-1106 (handler)Dispatch handler in the main CallToolRequestSchema switch statement that parses arguments using the schema and invokes the getDataset handler function.case 'get_dataset': { const args = getDatasetSchema.parse(request.params.arguments); return await getDataset(this.client, args); }