Skip to main content
Glama
michaelwaves

Hugging Face Hub MCP Server

by michaelwaves

hf_get_model_info

Retrieve detailed metadata, files, and configuration for any model on the Hugging Face Hub by specifying its repository ID, enabling comprehensive exploration and analysis.

Instructions

Get detailed information for a specific model including metadata, files, configuration, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_idYesModel repository ID (e.g., 'microsoft/DialoGPT-medium')
revisionNoOptional git revision (branch, tag, or commit hash)

Implementation Reference

  • The main handler function that implements the hf_get_model_info tool logic. It validates the arguments using isModelInfoArgs, extracts repo_id and optional revision, calls client.getModelInfo, and returns the result or error.
    export async function handleGetModelInfo(client: HuggingFaceClient, args: unknown): Promise<CallToolResult> {
        try {
            if (!isModelInfoArgs(args)) {
                throw new Error("Invalid arguments for hf_get_model_info");
            }
    
            const { repo_id, revision } = args;
            const results = await client.getModelInfo(repo_id, revision);
            
            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 object for hf_get_model_info, including name, description, and input schema for validation.
    export const getModelInfoToolDefinition: Tool = {
        name: "hf_get_model_info",
        description:
            "Get detailed information for a specific model including metadata, files, configuration, and more.",
        inputSchema: {
            type: "object",
            properties: {
                repo_id: {
                    type: "string",
                    description: "Model repository ID (e.g., 'microsoft/DialoGPT-medium')"
                },
                revision: {
                    type: "string",
                    description: "Optional git revision (branch, tag, or commit hash)"
                }
            },
            required: ["repo_id"]
        }
    };
  • src/server.ts:68-102 (registration)
    Registration of the hf_get_model_info handler in the MCP server's CallToolRequestSchema handler via switch case dispatch.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
        const { name, arguments: args } = request.params;
    
        switch (name) {
            case 'hf_list_models':
                return handleListModels(this.client, args);
            
            case 'hf_get_model_info':
                return handleGetModelInfo(this.client, args);
            
            case 'hf_get_model_tags':
                return handleGetModelTags(this.client, args);
            
            case 'hf_list_datasets':
                return handleListDatasets(this.client, args);
            
            case 'hf_get_dataset_info':
                return handleGetDatasetInfo(this.client, args);
            
            case 'hf_get_dataset_parquet':
                return handleGetDatasetParquet(this.client, args);
            
            case 'hf_get_croissant':
                return handleGetCroissant(this.client, args);
            
            case 'hf_get_dataset_tags':
                return handleGetDatasetTags(this.client, args);
            
            default:
                throw new McpError(
                    ErrorCode.MethodNotFound,
                    `Unknown tool: ${name}`
                );
        }
    });
  • src/server.ts:55-66 (registration)
    Registration of the hf_get_model_info tool definition in the MCP server's ListToolsRequestSchema response.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
            listModelsToolDefinition,
            getModelInfoToolDefinition,
            getModelTagsToolDefinition,
            listDatasetsToolDefinition,
            getDatasetInfoToolDefinition,
            getDatasetParquetToolDefinition,
            getCroissantToolDefinition,
            getDatasetTagsToolDefinition
        ],
    }));
  • Type guard helper function used in the handler to validate input arguments for hf_get_model_info.
    function isModelInfoArgs(args: unknown): args is ModelInfoArgs {
        return (
            typeof args === "object" &&
            args !== null &&
            "repo_id" in args &&
            typeof (args as { repo_id: string }).repo_id === "string"
        );
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states what is retrieved without disclosing behavioral traits like rate limits, authentication needs, or response format. It adds minimal context beyond the basic operation.

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 a single, efficient sentence that front-loads the purpose. It could be slightly more structured but wastes no words, earning its place clearly.

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

Completeness3/5

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

Given no annotations and no output schema, the description is adequate for a read-only tool but lacks details on return values or error handling. It covers the basic operation but leaves gaps in behavioral context.

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?

Schema description coverage is 100%, so the schema already documents both parameters well. The description does not add meaning beyond the schema, such as examples of metadata or configuration details, meeting the baseline for high coverage.

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 verb ('Get') and resource ('detailed information for a specific model'), specifying what metadata is included. It distinguishes from siblings like hf_get_model_tags (tags only) and hf_list_models (listing vs. detailed info), though not explicitly named.

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?

No explicit guidance on when to use this tool versus alternatives like hf_get_model_tags or hf_list_models is provided. The description implies usage for detailed model info but lacks context on prerequisites or exclusions.

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