Skip to main content
Glama
cfahlgren1

HF Dataset MCP

by cfahlgren1

list_splits

Retrieve all available configurations and splits for a Hugging Face dataset to understand its structure and data organization.

Instructions

Get all available configurations and splits for a dataset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasetYesDataset ID (e.g., 'stanfordnlp/imdb')

Implementation Reference

  • Registration and handler implementation for the list_splits tool.
    export function registerListSplits(server: McpServer) {
      server.tool(
        "list_splits",
        "Get all available configurations and splits for a dataset",
        {
          dataset: z.string().describe("Dataset ID (e.g., 'stanfordnlp/imdb')"),
        },
        async ({ dataset }) => {
          const data = await fetchDatasetViewer<SplitsResponse>("/splits", {
            dataset,
          });
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(data.splits, null, 2),
              },
            ],
          };
        }
      );
    }
  • Interface defining the expected response structure for splits.
    interface SplitsResponse {
      splits: Array<{
        dataset: string;
        config: string;
        split: string;
      }>;
      pending: unknown[];
      failed: unknown[];
    }

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/cfahlgren1/hf-dataset-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server