hf_get_dataset_info
Retrieve comprehensive details about a dataset, including metadata, files, and configurations from the Hugging Face Hub. Specify the dataset repository ID and optional revision for targeted information.
Instructions
Get detailed information for a specific dataset including metadata, files, configuration, and more.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| full | No | Whether to fetch most dataset data including all tags and files | |
| repo_id | Yes | Dataset repository ID (e.g., 'squad', 'imdb') | |
| revision | No | Optional git revision (branch, tag, or commit hash) |
Implementation Reference
- src/tools/datasets.ts:198-223 (handler)The handler function that executes the tool logic: validates arguments, calls the HuggingFaceClient to retrieve dataset information, and returns formatted result or error.export async function handleGetDatasetInfo(client: HuggingFaceClient, args: unknown): Promise<CallToolResult> { try { if (!isDatasetInfoArgs(args)) { throw new Error("Invalid arguments for hf_get_dataset_info"); } const { repo_id, revision, full } = args; const params = full ? { full } : {}; const results = await client.getDatasetInfo(repo_id, revision, params); return { content: [{ type: "text", text: results }], isError: false, }; } catch (error) { return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/tools/datasets.ts:56-78 (schema)Tool definition object containing the name, description, and input schema (JSON schema) for validating tool arguments.export const getDatasetInfoToolDefinition: Tool = { name: "hf_get_dataset_info", description: "Get detailed information for a specific dataset including metadata, files, configuration, and more.", inputSchema: { type: "object", properties: { repo_id: { type: "string", description: "Dataset repository ID (e.g., 'squad', 'imdb')" }, revision: { type: "string", description: "Optional git revision (branch, tag, or commit hash)" }, full: { type: "boolean", description: "Whether to fetch most dataset data including all tags and files" } }, required: ["repo_id"] } };
- src/server.ts:84-85 (registration)Registration in the tool dispatch switch statement: routes calls to 'hf_get_dataset_info' to the handleGetDatasetInfo handler.case 'hf_get_dataset_info': return handleGetDatasetInfo(this.client, args);
- src/server.ts:57-64 (registration)Registration of the tool definition in the ListToolsRequest handler, making the schema available to clients.listModelsToolDefinition, getModelInfoToolDefinition, getModelTagsToolDefinition, listDatasetsToolDefinition, getDatasetInfoToolDefinition, getDatasetParquetToolDefinition, getCroissantToolDefinition, getDatasetTagsToolDefinition
- src/tools/datasets.ts:146-152 (helper)Type guard helper function used by the handler to validate input arguments before processing.function isDatasetInfoArgs(args: unknown): args is DatasetInfoArgs { return ( typeof args === "object" && args !== null && "repo_id" in args && typeof (args as { repo_id: string }).repo_id === "string" );