Skip to main content
Glama
therealsachin

Langfuse MCP Server

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

TableJSON Schema
NameRequiredDescriptionDefault
datasetNameYesName of the dataset to retrieve

Implementation Reference

  • 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,
        };
      }
    }
  • 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'],
      },
    },
  • 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);
    }

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