Skip to main content
Glama
michaelwaves

Hugging Face Hub MCP Server

by michaelwaves

hf_get_croissant

Retrieve Croissant metadata for a dataset from the Hugging Face Hub, enabling structured access to machine learning datasets in a high-level format.

Instructions

Get the Croissant metadata for a dataset. Croissant is a high-level format for machine learning datasets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_idYesDataset repository ID

Implementation Reference

  • The handler function that executes the tool logic: validates input, calls the HuggingFaceClient to fetch Croissant metadata, and returns the result or error.
    export async function handleGetCroissant(client: HuggingFaceClient, args: unknown): Promise<CallToolResult> {
        try {
            if (!isCroissantArgs(args)) {
                throw new Error("Invalid arguments for hf_get_croissant");
            }
    
            const { repo_id } = args;
            const results = await client.getDatasetCroissant(repo_id);
            
            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,
            };
        }
    }
  • The tool definition including name, description, and input schema (requires repo_id).
    export const getCroissantToolDefinition: Tool = {
        name: "hf_get_croissant",
        description: "Get the Croissant metadata for a dataset. Croissant is a high-level format for machine learning datasets.",
        inputSchema: {
            type: "object",
            properties: {
                repo_id: {
                    type: "string", 
                    description: "Dataset repository ID"
                }
            },
            required: ["repo_id"]
        }
    };
  • src/server.ts:55-66 (registration)
    Registration of the tool definition in the MCP server's list tools request handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
            listModelsToolDefinition,
            getModelInfoToolDefinition,
            getModelTagsToolDefinition,
            listDatasetsToolDefinition,
            getDatasetInfoToolDefinition,
            getDatasetParquetToolDefinition,
            getCroissantToolDefinition,
            getDatasetTagsToolDefinition
        ],
    }));
  • src/server.ts:90-91 (registration)
    Mapping of the tool name to its handler function in the MCP server's call tool request switch statement.
    case 'hf_get_croissant':
        return handleGetCroissant(this.client, args);
  • Core client method that makes the HTTP GET request to the Hugging Face API endpoint for Croissant metadata and stringifies the response.
    async getDatasetCroissant(repoId: string): Promise<string> {
        try {
            const response: AxiosResponse = await this.httpClient.get(`/api/datasets/${repoId}/croissant`);
            return JSON.stringify(response.data, null, 2);
        } catch (error) {
            throw new Error(`Failed to fetch Croissant metadata: ${error instanceof Error ? error.message : String(error)}`);
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves metadata, implying a read-only operation, but doesn't disclose any behavioral traits such as authentication needs, rate limits, error handling, or what the output looks like (e.g., format, structure). This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences. The first sentence directly states the purpose, and the second adds context about Croissant. There's no wasted text, making it efficient, though it could be slightly more front-loaded by integrating the context into the purpose statement for a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple retrieval), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what Croissant metadata entails, how it's returned, or any prerequisites. For a tool with no structured behavioral data, more detail is needed to ensure the agent can use it correctly without guesswork.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% coverage with a clear description for 'repo_id' as 'Dataset repository ID.' Since the description doesn't explain parameters further, it meets the baseline of 3 where the schema does the heavy lifting, but doesn't add extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the Croissant metadata for a dataset.' It specifies the verb ('Get') and resource ('Croissant metadata'), and distinguishes it from siblings by focusing on metadata rather than dataset info, parquet files, or tags. However, it doesn't explicitly differentiate from all siblings (e.g., 'hf_get_dataset_info' might also provide metadata), keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions Croissant is 'a high-level format for machine learning datasets,' which implies usage for ML datasets, but doesn't specify when to choose this over siblings like 'hf_get_dataset_info' or 'hf_get_dataset_parquet.' There's no explicit when/when-not or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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