Skip to main content
Glama

get_paper

Retrieve full text or specific sections of arXiv papers by paper ID for research and analysis.

Instructions

Get the full text of an arXiv paper.

Args:
    paper_id: arXiv paper ID (e.g., "2401.12345")
    section: Which section to return: "all", "abstract", "introduction", "method", "conclusion"

Returns:
    The paper text (full or specified section)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
sectionNoall

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_paper' tool. It is decorated with @mcp.tool() for registration. Handles caching via storage, searching/downloading PDF if needed, text extraction, and section extraction.
    @mcp.tool()
    def get_paper(paper_id: str, section: str = "all") -> str:
        """Get the full text of an arXiv paper.
    
        Args:
            paper_id: arXiv paper ID (e.g., "2401.12345")
            section: Which section to return: "all", "abstract", "introduction", "method", "conclusion"
    
        Returns:
            The paper text (full or specified section)
        """
        # Check cache first
        cached_text = storage.get_text(paper_id)
        if cached_text:
            if section == "all":
                return cached_text
            return extract_section(cached_text, section)
    
        # Search for the paper
        papers = search_papers(paper_id, max_results=1)
        if not papers:
            return f"Paper {paper_id} not found."
    
        paper = papers[0]
    
        # Download PDF
        pdf_path = storage.get_pdf_path(paper_id)
        try:
            download_pdf(paper, str(pdf_path))
        except Exception as e:
            return f"Failed to download paper: {e}"
    
        # Extract text
        try:
            full_text = extract_text(str(pdf_path))
        except Exception as e:
            return f"Failed to extract text from PDF: {e}"
    
        # Cache results
        storage.save_paper_metadata(paper)
        storage.save_text(paper_id, full_text)
    
        if section == "all":
            return full_text
        return extract_section(full_text, section)
  • The @mcp.tool() decorator registers the get_paper function as an MCP tool.
    @mcp.tool()
  • The docstring provides the input schema (parameters) and output description for the tool.
    """Get the full text of an arXiv paper.
    
    Args:
        paper_id: arXiv paper ID (e.g., "2401.12345")
        section: Which section to return: "all", "abstract", "introduction", "method", "conclusion"
    
    Returns:
        The paper text (full or specified section)
    """
  • Helper method used by get_paper for retrieving cached text.
    def get_text(self, paper_id: str) -> str | None:
        text_path = self.get_text_path(paper_id)
        if text_path.exists():
            return text_path.read_text()
        return None
Behavior3/5

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

With no annotations provided, the description carries the full burden. It describes the basic behavior of retrieving text and specifies return values, but lacks details on error handling, rate limits, or authentication needs. It does not contradict annotations, as none exist.

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 the core purpose followed by structured Arg and Return sections. Every sentence adds value without redundancy, 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.

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, no annotations, and an output schema (which handles return values), the description is mostly complete. It covers purpose, parameters, and returns, but could improve by adding behavioral context like error cases or usage guidelines relative to siblings.

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 significant meaning beyond the input schema, which has 0% description coverage. It explains 'paper_id' with an example format and 'section' with allowed values and default, compensating well for the schema's lack of documentation. However, it doesn't detail constraints like paper ID validation.

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 verb 'Get' and resource 'full text of an arXiv paper', making the purpose specific and actionable. It distinguishes from sibling tools like 'list_downloaded_papers' (which lists) and 'search' (which searches) by focusing on retrieving specific paper content.

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 when you need paper text, but does not explicitly state when to use this tool versus alternatives like 'search' for finding papers or 'list_downloaded_papers' for checking availability. No exclusions or prerequisites are mentioned, leaving some ambiguity.

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/AnnaSuSu/arxiv-mcp'

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