Skip to main content
Glama
openags

Paper Search MCP

by openags

read_arxiv_paper

Extract text content from arXiv paper PDFs using the paper ID to access and process academic research documents for analysis.

Instructions

Read and extract text content from an arXiv paper PDF.

Args: paper_id: arXiv paper ID (e.g., '2106.12345'). save_path: Directory where the PDF is/will be saved (default: './downloads'). Returns: str: The extracted text content of the paper.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo./downloads

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler for the read_arxiv_paper tool in the MCP server, which delegates to the ArxivSearcher.
    async def read_arxiv_paper(paper_id: str, save_path: str = "./downloads") -> str:
        """Read and extract text content from an arXiv paper PDF.
    
        Args:
            paper_id: arXiv paper ID (e.g., '2106.12345').
            save_path: Directory where the PDF is/will be saved (default: './downloads').
        Returns:
            str: The extracted text content of the paper.
        """
        try:
            return arxiv_searcher.read_paper(paper_id, save_path)
        except Exception as e:
            print(f"Error reading paper {paper_id}: {e}")
            return ""
  • The actual implementation logic that reads a PDF file and extracts its text content.
    def read_paper(self, paper_id: str, save_path: str = "./downloads") -> str:
        """Read a paper and convert it to text format.
        
        Args:
            paper_id: arXiv paper ID
            save_path: Directory where the PDF is/will be saved
            
        Returns:
            str: The extracted text content of the paper
        """
        # First ensure we have the PDF
        pdf_path = f"{save_path}/{paper_id}.pdf"
        if not os.path.exists(pdf_path):
            pdf_path = self.download_pdf(paper_id, save_path)
        
        # Read the PDF
        try:
            reader = PdfReader(pdf_path)
            text = ""
            
            # Extract text from each page
            for page in reader.pages:
                text += page.extract_text() + "\n"
            
            return text.strip()
        except Exception as e:
            print(f"Error reading PDF for paper {paper_id}: {e}")
            return ""
  • The MCP tool registration decorator for the read_arxiv_paper function.
    @mcp.tool()
    async def read_arxiv_paper(paper_id: str, save_path: str = "./downloads") -> str:
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 extracts text content and saves PDFs to a directory, but it lacks details on permissions required, rate limits, error handling (e.g., invalid paper IDs), or whether it downloads PDFs if not locally available. This leaves significant gaps for a tool that interacts with external resources.

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 efficiently structured with a clear purpose statement followed by labeled sections for arguments and returns. Every sentence adds value: the first defines the tool's function, and the subsequent lines clarify parameters and output without redundancy. It is front-loaded and wastes no words.

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 (2 parameters, no annotations, but with an output schema), the description is reasonably complete. It explains what the tool does, details parameters, and specifies the return type. The output schema handles return values, so the description need not elaborate further. However, it could improve by addressing behavioral aspects like error conditions or dependencies.

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?

Schema description coverage is 0%, so the description must compensate. It provides clear semantics for both parameters: 'paper_id' is explained with an example format ('e.g., '2106.12345''), and 'save_path' is described as the directory for PDF storage with a default value. This adds meaningful context beyond the bare schema, though it could elaborate on path validation or paper ID constraints.

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 specific action ('Read and extract text content') and target resource ('from an arXiv paper PDF'), distinguishing it from sibling tools like 'download_arxiv' (which likely downloads files) and 'search_arxiv' (which searches metadata). It precisely communicates the tool's function without ambiguity.

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 the resource type ('arXiv paper PDF'), but it does not explicitly state when to use this tool versus alternatives like 'read_base_paper' or 'download_arxiv'. No exclusions or prerequisites are mentioned, leaving the agent to infer context from the tool name and description alone.

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/openags/paper-search-mcp'

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