Skip to main content
Glama
shreyaskarnik

Hugging Face MCP Server

get-paper-info

Retrieve detailed information about research papers using their arXiv ID to access metadata and content from Hugging Face Hub.

Instructions

Get information about a specific paper on Hugging Face

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
arxiv_idYesThe arXiv ID of the paper (e.g., '1810.04805')

Implementation Reference

  • Handler function that executes the get-paper-info tool. Fetches paper details from Hugging Face API endpoint /papers/{arxiv_id}, formats the info including title, authors, summary, and implementations from /arxiv/{arxiv_id}/repos, returns JSON.
    elif name == "get-paper-info":
        arxiv_id = arguments.get("arxiv_id")
        if not arxiv_id:
            return [types.TextContent(type="text", text="Error: arxiv_id is required")]
    
        data = await make_hf_request(f"papers/{arxiv_id}")
    
        if "error" in data:
            return [
                types.TextContent(
                    type="text",
                    text=f"Error retrieving paper information: {data['error']}",
                )
            ]
    
        # Format the result
        paper_info = {
            "arxiv_id": data.get("arxivId", ""),
            "title": data.get("title", ""),
            "authors": data.get("authors", []),
            "summary": data.get("summary", "No summary available"),
            "url": f"https://huggingface.co/papers/{arxiv_id}",
        }
    
        # Get implementations
        implementations = await make_hf_request(f"arxiv/{arxiv_id}/repos")
        if "error" not in implementations:
            paper_info["implementations"] = implementations
    
        return [types.TextContent(type="text", text=json.dumps(paper_info, indent=2))]
  • JSON Schema definition for the get-paper-info tool input, requiring 'arxiv_id' string.
    types.Tool(
        name="get-paper-info",
        description="Get information about a specific paper on Hugging Face",
        inputSchema={
            "type": "object",
            "properties": {
                "arxiv_id": {
                    "type": "string",
                    "description": "The arXiv ID of the paper (e.g., '1810.04805')",
                },
            },
            "required": ["arxiv_id"],
        },
    ),
  • The tool is registered in the handle_list_tools() function via @server.list_tools() decorator, which returns a list including the Tool object for get-paper-info.
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """
        List available tools for interacting with the Hugging Face Hub.
        Each tool specifies its arguments using JSON Schema validation.
        """
        return [
            # Model Tools
            types.Tool(
                name="search-models",
                description="Search for models on Hugging Face Hub",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "Search term (e.g., 'bert', 'gpt')",
                        },
                        "author": {
                            "type": "string",
                            "description": "Filter by author/organization (e.g., 'huggingface', 'google')",
                        },
                        "tags": {
                            "type": "string",
                            "description": "Filter by tags (e.g., 'text-classification', 'translation')",
                        },
                        "limit": {
                            "type": "integer",
                            "description": "Maximum number of results to return",
                        },
                    },
                },
            ),
            types.Tool(
                name="get-model-info",
                description="Get detailed information about a specific model",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "model_id": {
                            "type": "string",
                            "description": "The ID of the model (e.g., 'google/bert-base-uncased')",
                        },
                    },
                    "required": ["model_id"],
                },
            ),
            # Dataset Tools
            types.Tool(
                name="search-datasets",
                description="Search for datasets on Hugging Face Hub",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {"type": "string", "description": "Search term"},
                        "author": {
                            "type": "string",
                            "description": "Filter by author/organization",
                        },
                        "tags": {"type": "string", "description": "Filter by tags"},
                        "limit": {
                            "type": "integer",
                            "description": "Maximum number of results to return",
                        },
                    },
                },
            ),
            types.Tool(
                name="get-dataset-info",
                description="Get detailed information about a specific dataset",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "dataset_id": {
                            "type": "string",
                            "description": "The ID of the dataset (e.g., 'squad')",
                        },
                    },
                    "required": ["dataset_id"],
                },
            ),
            # Space Tools
            types.Tool(
                name="search-spaces",
                description="Search for Spaces on Hugging Face Hub",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "query": {"type": "string", "description": "Search term"},
                        "author": {
                            "type": "string",
                            "description": "Filter by author/organization",
                        },
                        "tags": {"type": "string", "description": "Filter by tags"},
                        "sdk": {
                            "type": "string",
                            "description": "Filter by SDK (e.g., 'streamlit', 'gradio', 'docker')",
                        },
                        "limit": {
                            "type": "integer",
                            "description": "Maximum number of results to return",
                        },
                    },
                },
            ),
            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"],
                },
            ),
            # Papers Tools
            types.Tool(
                name="get-paper-info",
                description="Get information about a specific paper on Hugging Face",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "arxiv_id": {
                            "type": "string",
                            "description": "The arXiv ID of the paper (e.g., '1810.04805')",
                        },
                    },
                    "required": ["arxiv_id"],
                },
            ),
            types.Tool(
                name="get-daily-papers",
                description="Get the list of daily papers curated by Hugging Face",
                inputSchema={
                    "type": "object",
                    "properties": {},
                },
            ),
            # Collections Tools
            types.Tool(
                name="search-collections",
                description="Search for collections on Hugging Face Hub",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "owner": {"type": "string", "description": "Filter by owner"},
                        "item": {
                            "type": "string",
                            "description": "Filter by item (e.g., 'models/teknium/OpenHermes-2.5-Mistral-7B')",
                        },
                        "query": {
                            "type": "string",
                            "description": "Search term for titles and descriptions",
                        },
                        "limit": {
                            "type": "integer",
                            "description": "Maximum number of results to return",
                        },
                    },
                },
            ),
            types.Tool(
                name="get-collection-info",
                description="Get detailed information about a specific collection",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "namespace": {
                            "type": "string",
                            "description": "The namespace of the collection (user or organization)",
                        },
                        "collection_id": {
                            "type": "string",
                            "description": "The ID part of the collection",
                        },
                    },
                    "required": ["namespace", "collection_id"],
                },
            ),
        ]
  • Helper function used by the handler to make API requests to Hugging Face endpoints.
    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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets information' but doesn't clarify what kind of information is returned, whether it's read-only, if there are rate limits, authentication requirements, or error conditions. This leaves significant gaps for an agent to understand how the tool behaves.

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, clear sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it efficient for an agent to parse.

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 information is returned about the paper, potential error cases, or how this tool fits within the broader Hugging Face ecosystem alongside its siblings. For a tool with no structured output documentation, 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 input schema has 100% description coverage, with the single parameter 'arxiv_id' clearly documented in the schema. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 action ('Get information') and resource ('specific paper on Hugging Face'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings like 'get-model-info' or 'get-dataset-info' beyond specifying 'paper' as the resource type, which is why it doesn't reach 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. With siblings like 'get-daily-papers' (likely for listing papers) and 'search-models' (for different resource types), there's no indication of when this specific paper lookup is appropriate or what distinguishes it from other retrieval tools.

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