Skip to main content
Glama
shreyaskarnik

Hugging Face MCP Server

get-space-info

Retrieve detailed information about a specific Hugging Face Space, including its configuration, files, and metadata, by providing the Space ID.

Instructions

Get detailed information about a specific Space

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_idYesThe ID of the Space (e.g., 'huggingface/diffusers-demo')

Implementation Reference

  • Handler for the 'get-space-info' tool within the @server.call_tool() function. It retrieves space details from the Hugging Face API endpoint '/spaces/{space_id}', handles errors, formats key information including id, name, author, sdk, tags, likes, lastModified, description, and url, then returns formatted JSON.
    elif name == "get-space-info":
        space_id = arguments.get("space_id")
        if not space_id:
            return [types.TextContent(type="text", text="Error: space_id is required")]
    
        data = await make_hf_request(f"spaces/{quote_plus(space_id)}")
    
        if "error" in data:
            return [
                types.TextContent(
                    type="text",
                    text=f"Error retrieving space information: {data['error']}",
                )
            ]
    
        # Format the result
        space_info = {
            "id": data.get("id", ""),
            "name": data.get("spaceId", ""),
            "author": data.get("author", ""),
            "sdk": data.get("sdk", ""),
            "tags": data.get("tags", []),
            "likes": data.get("likes", 0),
            "lastModified": data.get("lastModified", ""),
            "description": data.get("description", "No description available"),
            "url": f"https://huggingface.co/spaces/{space_id}",
        }
    
        return [types.TextContent(type="text", text=json.dumps(space_info, indent=2))]
  • Schema and registration of the 'get-space-info' tool in the @server.list_tools() handler. Defines the tool name, description, and input schema requiring a 'space_id' string.
    types.Tool(
        name="get-space-info",
        description="Get detailed information about a specific Space",
        inputSchema={
            "type": "object",
            "properties": {
                "space_id": {
                    "type": "string",
                    "description": "The ID of the Space (e.g., 'huggingface/diffusers-demo')",
                },
            },
            "required": ["space_id"],
        },
    ),
  • Shared helper function 'make_hf_request' used by the get-space-info handler to perform HTTP GET requests to Hugging Face API endpoints with error handling.
    async def make_hf_request(
        endpoint: str, params: Optional[Dict[str, Any]] = None
    ) -> Dict:
        """Make a request to the Hugging Face API with proper error handling."""
        url = f"{HF_API_BASE}/{endpoint}"
        try:
            response = await http_client.get(url, params=params)
            response.raise_for_status()
            return response.json()
        except Exception as e:
            return {"error": str(e)}
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool gets 'detailed information' but doesn't specify what that includes (e.g., metadata, statistics, permissions), whether it's read-only or has side effects, or any rate limits or authentication needs. This leaves significant gaps for a tool that likely interacts with external resources.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detailed information' entails (e.g., structure, format), behavioral traits like error handling, or how it differs from sibling tools. For a tool with external dependencies and no structured output, more context is needed.

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 schema description coverage is 100%, with the single parameter 'space_id' fully documented in the schema (including an example). The description adds no additional parameter semantics beyond implying it's for a 'specific Space,' which aligns with but doesn't enhance the schema. This meets the baseline for high schema 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 about a specific Space'), making the purpose understandable. However, it doesn't differentiate this tool from its sibling 'search-spaces' tool, which likely serves a different purpose (searching vs. getting specific details).

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 like 'search-spaces' or other 'get-*' siblings (e.g., 'get-model-info'). It mentions 'specific Space' but doesn't clarify prerequisites or exclusions, leaving usage context implied rather than explicit.

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

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/shreyaskarnik/huggingface-mcp-server'

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