Skip to main content
Glama
afrise

Academic Paper Search MCP Server

by afrise

fetch_paper_details

Retrieve comprehensive details for a specific academic paper, including metadata and abstracts, by providing its unique identifier and preferred database source (Crossref or Semantic Scholar).

Instructions

Get detailed information about a specific paper.

Args:
    paper_id: Paper identifier (DOI for Crossref, paper ID for Semantic Scholar)
    source: Source database ("semantic_scholar" or "crossref")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
sourceNosemantic_scholar

Implementation Reference

  • The main handler function for the 'fetch_paper_details' tool. It constructs the appropriate API URL based on the source, fetches the data using make_api_request, handles Crossref response structure, and formats the output using format_paper_data. Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def fetch_paper_details(paper_id: str, source: str = "semantic_scholar") -> str:
        """Get detailed information about a specific paper.
    
        Args:
            paper_id: Paper identifier (DOI for Crossref, paper ID for Semantic Scholar)
            source: Source database ("semantic_scholar" or "crossref")
        """
        if source == "semantic_scholar":
            url = f"{SEMANTIC_SCHOLAR_API}/paper/{paper_id}"
        elif source == "crossref":
            url = f"{CROSSREF_API}/{paper_id}"
        else:
            return "Unsupported source. Please use 'semantic_scholar' or 'crossref'."
    
        data = await make_api_request(url)
        
        if not data:
            return f"Unable to fetch paper details from {source}."
    
        if source == "crossref":
            data = data.get('message', {})
    
        return format_paper_data(data, source)
  • Helper function to make HTTP requests to the Semantic Scholar or Crossref APIs with error handling and timeout.
    async def make_api_request(url: str, headers: dict = None, params: dict = None) -> dict[str, Any] | None:
        """Make a request to the API with proper error handling."""
        if headers is None:
            headers = { "User-Agent": USER_AGENT }
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception as e:
                return None
  • Helper function that formats the raw API response data from either source into a consistent human-readable string format, handling fields like title, authors, year, DOI, and source-specific fields.
    def format_paper_data(data: dict, source: str) -> str:
        """Format paper data from different sources into a consistent string format."""
        if not data:
            return "No paper data available"
            
        try:
            if source == "semantic_scholar":
                title = unicodedata.normalize('NFKD', str(data.get('title', 'No title available')))
                authors = ', '.join([author.get('name', 'Unknown Author') for author in data.get('authors', [])])
                year = data.get('year') or 'Year unknown'
                external_ids = data.get('externalIds', {}) or {}
                doi = external_ids.get('DOI', 'No DOI available')
                venue = data.get('venue') or 'Venue unknown'
                abstract = data.get('abstract') or 'No abstract available'
                tldr = (data.get('tldr') or {}).get('text', '')
                is_open = "Yes" if data.get('isOpenAccess') else "No"
                pdf_data = data.get('openAccessPdf', {}) or {}
                pdf_url = pdf_data.get('url', 'Not available')
    
            elif source == "crossref":
                title = (data.get('title') or ['No title available'])[0]
                authors = ', '.join([
                    f"{author.get('given', '')} {author.get('family', '')}".strip() or 'Unknown Author'
                    for author in data.get('author', [])
                ])
                year = (data.get('published-print', {}).get('date-parts', [['']])[0][0]) or 'Year unknown'
                doi = data.get('DOI') or 'No DOI available'
                
            result = [
                f"Title: {title}",
                f"Authors: {authors}",
                f"Year: {year}",
                f"DOI: {doi}"
            ]
            
            if source == "semantic_scholar":
                result.extend([
                    f"Venue: {venue}",
                    f"Open Access: {is_open}",
                    f"PDF URL: {pdf_url}",
                    f"Abstract: {abstract}"
                ])
                if tldr:
                    result.append(f"TL;DR: {tldr}")
                    
            return "\n".join(result) + "\t\t\n"
            
        except Exception as e:
            return f"Error formatting paper data: {str(e)}"
  • server.py:134-134 (registration)
    The @mcp.tool() decorator registers the fetch_paper_details function as an MCP tool.
    @mcp.tool()
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 'Get[s] detailed information,' which implies a read-only operation, but it doesn't disclose any behavioral traits such as authentication needs, rate limits, error handling, or what 'detailed information' includes. This leaves significant gaps in understanding how the tool behaves beyond its basic purpose.

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, starting with a clear purpose statement followed by a concise 'Args' section that lists parameters with brief explanations. Every sentence earns its place by providing essential information without unnecessary details, making it efficient and easy to parse.

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, no output schema), the description is partially complete. It covers the purpose and parameters well, but it lacks information on behavioral aspects like what 'detailed information' entails, potential errors, or usage constraints. Without an output schema, the description should ideally hint at the return structure, but it doesn't, leaving some context gaps.

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 description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'paper_id' is a 'Paper identifier (DOI for Crossref, paper ID for Semantic Scholar)' and 'source' is a 'Source database' with options 'semantic_scholar' or 'crossref'. This clarifies the purpose and format of the parameters, compensating well for the lack of schema descriptions.

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: 'Get detailed information about a specific paper.' This specifies the verb ('Get') and resource ('paper'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'search_by_topic' or 'search_papers', which likely return lists rather than details for a specific paper.

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 specifying that it's for a 'specific paper' and lists the required 'paper_id' and optional 'source' parameters. This suggests it should be used when you have a known paper identifier, but it doesn't explicitly state when to use this tool versus the sibling search tools or provide any exclusions or alternatives.

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/afrise/academic-search-mcp-server'

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