Skip to main content
Glama
openags

Paper Search MCP

by openags

read_iacr_paper

Extract text content from IACR ePrint papers by providing the paper ID, enabling analysis of cryptographic research documents.

Instructions

Read and extract text content from an IACR ePrint paper PDF.

Args: paper_id: IACR paper ID (e.g., '2009/101'). 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 MCP tool handler for 'read_iacr_paper' in server.py, which calls the underlying iacr_searcher instance.
    async def read_iacr_paper(paper_id: str, save_path: str = "./downloads") -> str:
        """Read and extract text content from an IACR ePrint paper PDF.
    
        Args:
            paper_id: IACR paper ID (e.g., '2009/101').
            save_path: Directory where the PDF is/will be saved (default: './downloads').
        Returns:
            str: The extracted text content of the paper.
        """
        try:
            return iacr_searcher.read_paper(paper_id, save_path)
        except Exception as e:
            print(f"Error reading paper {paper_id}: {e}")
            return ""
  • The core implementation of the read_paper logic within the IACRSearcher class.
    def read_paper(self, paper_id: str, save_path: str = "./downloads") -> str:
        """
        Download and extract text from IACR paper PDF
    
        Args:
            paper_id: IACR paper ID
            save_path: Directory to save downloaded PDF
    
        Returns:
            str: Extracted text from the PDF or error message
        """
        try:
            # First get paper details to get the PDF URL
            paper = self.get_paper_details(paper_id)
            if not paper or not paper.pdf_url:
                return f"Error: Could not find PDF URL for paper {paper_id}"
    
            # Download the PDF
            pdf_response = requests.get(paper.pdf_url, timeout=30)
            pdf_response.raise_for_status()
    
            # Create download directory if it doesn't exist
            os.makedirs(save_path, exist_ok=True)
    
            # Save the PDF
            filename = f"iacr_{paper_id.replace('/', '_')}.pdf"
            pdf_path = os.path.join(save_path, filename)
    
            with open(pdf_path, "wb") as f:
                f.write(pdf_response.content)
    
            # Extract text using PyPDF2
            reader = PdfReader(pdf_path)
            text = ""
    
            for page_num, page in enumerate(reader.pages):
                try:
                    page_text = page.extract_text()
                    if page_text:
                        text += f"\n--- Page {page_num + 1} ---\n"
                        text += page_text + "\n"
                except Exception as e:
                    logger.warning(
                        f"Failed to extract text from page {page_num + 1}: {e}"
                    )
                    continue
    
            if not text.strip():
                return (
                    f"PDF downloaded to {pdf_path}, but unable to extract readable text"
                )
    
            # Add paper metadata at the beginning
            metadata = f"Title: {paper.title}\n"
            metadata += f"Authors: {', '.join(paper.authors)}\n"
            metadata += f"Published Date: {paper.published_date}\n"
            metadata += f"URL: {paper.url}\n"
            metadata += f"PDF downloaded to: {pdf_path}\n"
            metadata += "=" * 80 + "\n\n"
    
            return metadata + text.strip()
    
        except requests.RequestException as e:
            logger.error(f"Error downloading PDF: {e}")
            return f"Error downloading PDF: {e}"
        except Exception as e:
            logger.error(f"Read paper error: {e}")
            return f"Error reading paper: {e}"
  • Tool registration decorator for read_iacr_paper.
    @mcp.tool()
    async def read_iacr_paper(paper_id: str, save_path: str = "./downloads") -> str:
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool reads and extracts text, implying it downloads or accesses a PDF, but doesn't disclose behavioral traits like network usage, error handling, file system operations (saving to 'save_path'), or performance characteristics. The description adds minimal context beyond the basic action.

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 well-structured and appropriately sized: a clear purpose statement followed by Args and Returns sections. Each sentence earns its place by defining the tool, parameters, and output. It could be slightly more concise by integrating the default into the purpose, but overall it's efficient.

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 covers the purpose, parameters, and return value. The output schema exists, so the description doesn't need to explain return values further. However, it lacks details on prerequisites or error conditions, leaving some 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?

Schema description coverage is 0%, so the description must compensate. It adds meaning for both parameters: 'paper_id' is explained as 'IACR paper ID' with an example, and 'save_path' specifies the directory purpose and default value. This provides clear semantics beyond the bare schema, though it doesn't detail format constraints or edge cases.

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: 'Read and extract text content from an IACR ePrint paper PDF.' It specifies the verb ('read and extract'), resource ('IACR ePrint paper PDF'), and output ('text content'). However, it doesn't explicitly differentiate from sibling tools like 'download_iacr' or 'read_arxiv_paper' beyond the IACR focus.

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. With many sibling tools for different sources (e.g., 'read_arxiv_paper', 'download_iacr'), it doesn't explain if this tool downloads first or requires a pre-downloaded PDF, or when to choose it over other IACR-related tools.

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