Skip to main content
Glama
fegizii

Semantic Scholar MCP Server

by fegizii

get_paper

Retrieve detailed academic paper information using Semantic Scholar, ArXiv, or DOI identifiers. Specify fields to get citations, references, authors, and metadata.

Instructions

Get detailed information about a specific paper.

Args:
    paper_id: Paper ID (can be Semantic Scholar ID, DOI, ArXiv ID, etc.)
    fields: Comma-separated list of fields to return

Returns:
    Detailed paper information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
fieldsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler function for the 'get_paper' tool. Decorated with @mcp.tool() for automatic registration and schema inference. Fetches paper details from Semantic Scholar API endpoint /paper/{paper_id}, handles errors, extracts key fields, and formats a detailed text response including title, authors, abstract, citations, references count, and PDF info.
    @mcp.tool()
    async def get_paper(paper_id: str, fields: Optional[str] = None) -> str:
        """
        Get detailed information about a specific paper.
    
        Args:
            paper_id: Paper ID (can be Semantic Scholar ID, DOI, ArXiv ID, etc.)
            fields: Comma-separated list of fields to return
    
        Returns:
            Detailed paper information
        """
        params = {}
        if fields:
            params["fields"] = fields
        else:
            params["fields"] = (
                "paperId,title,authors,year,venue,citationCount,abstract,references,citations,openAccessPdf"
            )
    
        # URL encode the paper ID to handle DOIs and other special characters
        encoded_id = quote(paper_id, safe="")
    
        result = await make_api_request(f"paper/{encoded_id}", params)
    
        if result is None:
            return "Error: Failed to fetch paper"
    
        if "error" in result:
            return f"Error: {result['error']}"
    
        paper = result
        title = paper.get("title", "Unknown Title")
        authors = paper.get("authors", [])
        author_names = [author.get("name", "Unknown") for author in authors]
    
        year = paper.get("year", "Unknown")
        venue = paper.get("venue", "Unknown")
        citation_count = paper.get("citationCount", 0)
        abstract = paper.get("abstract", "No abstract available")
    
        references = paper.get("references", [])
        citations = paper.get("citations", [])
    
        open_access = paper.get("openAccessPdf")
        pdf_url = open_access.get("url") if open_access else "No open access PDF"
    
        result_text = f"""Title: {title}
    Authors: {', '.join(author_names)}
    Year: {year}
    Venue: {venue}
    Citations: {citation_count}
    Paper ID: {paper.get('paperId', 'Unknown')}
    
    Abstract:
    {abstract}
    
    References: {len(references)}
    Cited by: {len(citations)}
    Open Access PDF: {pdf_url}"""
    
        return result_text
  • Key helper function used by get_paper to perform authenticated API requests to Semantic Scholar, with comprehensive error handling for rate limits, HTTP errors, and general exceptions.
    async def make_api_request(
        endpoint: str, params: Optional[Dict[str, Any]] = None, method: str = "GET"
    ) -> Optional[Dict[str, Any]]:
        """Make a request to the Semantic Scholar API."""
        url = f"{BASE_URL}/{endpoint.lstrip('/')}"
    
        headers = {
            "Accept": "application/json",
            "User-Agent": f"semantic-scholar-mcp/{USER_AGENT_VERSION}",
        }
    
        if API_KEY:
            headers["x-api-key"] = API_KEY
    
        try:
            async with httpx.AsyncClient(timeout=API_TIMEOUT) as client:
                if method == "GET":
                    response = await client.get(url, headers=headers, params=params)
                elif method == "POST":
                    response = await client.post(url, headers=headers, json=params)
                else:
                    raise ValueError(f"Unsupported HTTP method: {method}")
    
                response.raise_for_status()
                return response.json()
    
        except httpx.HTTPStatusError as e:
            if e.response.status_code == 403:
                if not API_KEY:
                    return {
                        "error": "Rate limit exceeded. The shared public rate limit (1000 req/sec) may be exceeded. Get a free API key from https://www.semanticscholar.org/product/api for dedicated limits."
                    }
                else:
                    return {
                        "error": f"API key may be invalid or rate limit exceeded: {str(e)}"
                    }
            elif e.response.status_code == 429:
                return {
                    "error": "Rate limit exceeded. Please wait a moment and try again, or get an API key for dedicated higher limits."
                }
            else:
                return {"error": f"HTTP error: {str(e)}"}
        except httpx.HTTPError as e:
            return {"error": f"HTTP error: {str(e)}"}
        except Exception as e:
            return {"error": f"Request failed: {str(e)}"}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool returns 'detailed paper information' but lacks critical details such as authentication requirements, rate limits, error handling, or whether it's a read-only operation. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

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 and front-loaded, starting with the core purpose. The use of sections for 'Args' and 'Returns' adds structure, but the 'Returns' section is redundant given the existence of an output schema, slightly reducing efficiency.

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 the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is somewhat complete. It covers the basic purpose and parameters but lacks behavioral context and usage guidelines. The output schema reduces the need to explain return values, but overall, it's adequate with clear gaps in guidance and transparency.

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 some meaning beyond the input schema by explaining that 'paper_id' can include various identifiers (Semantic Scholar ID, DOI, ArXiv ID) and that 'fields' is a comma-separated list. However, with 0% schema description coverage, it doesn't fully compensate for the lack of schema details, such as what specific fields are available or examples of valid inputs.

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 with a specific verb ('Get') and resource ('detailed information about a specific paper'), making it easy to understand what the tool does. However, it doesn't differentiate from siblings like 'get_paper_batch' or 'get_paper_citations', which also retrieve paper information but with different scopes or additional data.

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 doesn't mention siblings like 'get_paper_batch' for multiple papers or 'search_papers' for broader queries, nor does it specify prerequisites or exclusions, leaving usage context unclear.

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/fegizii/SemanticScholarMCP'

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