Skip to main content
Glama

apaper_read_iacr_paper

Extract text content from IACR ePrint papers by specifying paper ID and page ranges to access cryptographic research materials.

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') start_page: Starting page number (1-indexed, inclusive). Defaults to 1. end_page: Ending page number (1-indexed, inclusive). Defaults to last page.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo./downloads
start_pageNo
end_pageNo

Implementation Reference

  • MCP tool handler for 'apaper_read_iacr_paper' (inferred name from FastMCP('apaper') prefix). Converts args, calls IACRSearcher.read_paper, handles truncation and errors.
    @mcp.tool()
    def read_iacr_paper(
        paper_id: str,
        save_path: str = "./downloads",
        start_page: int | str | None = None,
        end_page: int | str | None = None,
    ) -> 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')
            start_page: Starting page number (1-indexed, inclusive). Defaults to 1.
            end_page: Ending page number (1-indexed, inclusive). Defaults to last page.
        """
        try:
            # Convert string parameters to integers if needed
            start_page_int = None
            end_page_int = None
            
            if start_page is not None:
                start_page_int = int(start_page)
            
            if end_page is not None:
                end_page_int = int(end_page)
            
            result = iacr_searcher.read_paper(
                paper_id, save_path, start_page=start_page_int, end_page=end_page_int
            )
    
            if result.startswith("Error"):
                return result
            else:
                # Truncate very long text for display
                if len(result) > 5000:
                    truncated_result = (
                        result[:5000]
                        + f"\n\n... [Text truncated. Full text is {len(result)} characters long]"
                    )
                    return truncated_result
                else:
                    return result
        except ValueError as e:
            return f"Error: Invalid page number format. Please provide valid integers for start_page and end_page."
        except Exception as e:
            return f"Error reading IACR paper: {str(e)}"
  • Core implementation of reading IACR paper: fetches details, extracts PDF text using utils.pdf_reader.read_pdf, prepends metadata.
    def read_paper(self, paper_id: str, save_path: str = "./downloads", start_page: int | None = None, end_page: int | None = None) -> str:
        """
        Download and extract text from IACR paper PDF
    
        Args:
            paper_id: IACR paper ID
            save_path: Directory to save downloaded PDF
            start_page: Starting page number (1-indexed, inclusive). Defaults to 1.
            end_page: Ending page number (1-indexed, inclusive). Defaults to last page.
    
        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}"
    
            # Use the read_pdf function to extract text
            text = read_pdf(paper.pdf_url, start_page, end_page)
    
            # 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 URL: {paper.pdf_url}\n"
            metadata += "=" * 80 + "\n\n"
    
            return metadata + text
    
        except Exception as e:
            logger.error(f"Error reading paper: {e}")
            return f"Error reading paper: {e}"
  • FastMCP server initialization with 'apaper' prefix, implying tool names like 'apaper_read_iacr_paper'. Instantiates IACRSearcher used by the tool.
    mcp = FastMCP("apaper")

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/isomoes/all-in-mcp'

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