Skip to main content
Glama
fegizii

Semantic Scholar MCP Server

by fegizii

get_paper_citations

Retrieve academic papers that cite a specific publication to analyze research impact and track scholarly influence.

Instructions

Get papers that cite a specific paper.

Args:
    paper_id: Paper ID to get citations for
    limit: Maximum number of results (default: 10, max: 1000)
    offset: Number of results to skip (default: 0)
    fields: Comma-separated list of fields to return

Returns:
    List of citing papers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
limitNo
offsetNo
fieldsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_paper_citations' tool. It is registered via @mcp.tool() decorator, defines input schema via type annotations and docstring, fetches citations using make_api_request, formats them with format_paper, and returns formatted string output.
    @mcp.tool()
    async def get_paper_citations(
        paper_id: str, limit: int = 10, offset: int = 0, fields: Optional[str] = None
    ) -> str:
        """
        Get papers that cite a specific paper.
    
        Args:
            paper_id: Paper ID to get citations for
            limit: Maximum number of results (default: 10, max: 1000)
            offset: Number of results to skip (default: 0)
            fields: Comma-separated list of fields to return
    
        Returns:
            List of citing papers
        """
        params: Dict[str, Any] = {"limit": min(limit, 1000), "offset": offset}
    
        if fields:
            params["fields"] = fields
        else:
            params["fields"] = "paperId,title,authors,year,venue,citationCount"
    
        encoded_id = quote(paper_id, safe="")
        result = await make_api_request(f"paper/{encoded_id}/citations", params)
    
        if result is None:
            return "Error: Failed to fetch citations"
    
        if "error" in result:
            return f"Error: {result['error']}"
    
        citations = result.get("data", [])
        total = result.get("total", 0)
    
        if not citations:
            return "No citations found for this paper."
    
        formatted_citations = []
        for i, citation in enumerate(citations, 1):
            citing_paper = citation.get("citingPaper", {})
            if citing_paper:
                formatted_citations.append(f"{i}. {format_paper(citing_paper)}")
    
        result_text = (
            f"Found {total} total citations (showing {len(formatted_citations)}):\n\n"
        )
        result_text += "\n\n".join(formatted_citations)
    
        return result_text
  • Helper function used to format individual paper details in the citations list output.
    def format_paper(paper: Dict[str, Any]) -> str:
        """Format a paper for display."""
        title = paper.get("title", "Unknown Title")
        authors = paper.get("authors", [])
        author_names = [author.get("name", "Unknown") for author in authors[:3]]
        author_str = ", ".join(author_names)
        if len(authors) > 3:
            author_str += f" (and {len(authors) - 3} others)"
    
        year = paper.get("year")
        year_str = f" ({year})" if year else ""
    
        venue = paper.get("venue", "")
        venue_str = f" - {venue}" if venue else ""
    
        citation_count = paper.get("citationCount", 0)
    
        paper_id = paper.get("paperId", "")
    
        return f"Title: {title}\nAuthors: {author_str}{year_str}{venue_str}\nCitations: {citation_count}\nPaper ID: {paper_id}"
  • Core helper function that makes HTTP requests to the Semantic Scholar API, handles errors and rate limits, used by get_paper_citations to fetch the citations data.
    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?

No annotations are provided, so the description carries the full burden. It mentions default values and limits for parameters, which adds some behavioral context (e.g., pagination with limit/offset), but it doesn't disclose other traits like rate limits, authentication needs, error handling, or whether the operation is read-only (implied by 'Get' but not explicit). The description is minimal beyond parameter defaults.

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 appropriately sized and front-loaded: the first sentence states the purpose, followed by a structured 'Args' and 'Returns' section. Every sentence earns its place by explaining parameters and output without redundancy. It's efficient and well-organized.

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

Completeness4/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 (4 parameters, 1 required) and the presence of an output schema (implied by 'Returns: List of citing papers'), the description is mostly complete. It explains all parameters and the return type. However, with no annotations, it could benefit from more behavioral details like safety or performance traits, but the output schema reduces the need to fully describe return values.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining each parameter: paper_id ('Paper ID to get citations for'), limit ('Maximum number of results' with default and max), offset ('Number of results to skip' with default), and fields ('Comma-separated list of fields to return'). This covers all 4 parameters, providing clear semantics beyond the bare schema.

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

Purpose5/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 ('papers that cite a specific paper'), distinguishing it from siblings like get_paper_references (which gets papers cited by a paper) and get_paper (which gets paper details). The first sentence is direct and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage by stating 'Get papers that cite a specific paper,' which suggests it's for citation analysis, but it doesn't explicitly say when to use this tool versus alternatives like get_citation_context (which might provide context around citations) or search_papers (which might find papers by other criteria). No exclusions or prerequisites are mentioned.

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