Skip to main content
Glama

apaper_download_iacr_paper

Download PDFs of IACR ePrint papers by providing the paper ID and specifying a save directory for academic research purposes.

Instructions

Download PDF of an IACR ePrint paper

Args: paper_id: IACR paper ID (e.g., '2009/101') save_path: Directory to save the PDF (default: './downloads')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo./downloads

Implementation Reference

  • Registration and handler for the MCP tool 'apaper_download_iacr_paper'. This thin wrapper calls the IACRSearcher.download_pdf method.
    @mcp.tool()
    def download_iacr_paper(paper_id: str, save_path: str = "./downloads") -> str:
        """
        Download PDF of an IACR ePrint paper
        
        Args:
            paper_id: IACR paper ID (e.g., '2009/101')
            save_path: Directory to save the PDF (default: './downloads')
        """
        try:
            result = iacr_searcher.download_pdf(paper_id, save_path)
            
            if result.startswith(("Error", "Failed")):
                return f"Download failed: {result}"
            else:
                return f"PDF downloaded successfully to: {result}"
        except Exception as e:
            return f"Error downloading IACR paper: {str(e)}"
  • Core handler logic for downloading IACR paper PDFs. Constructs PDF URL, downloads the file, saves it locally, and returns the path or error.
    def download_pdf(self, paper_id: str, save_path: str) -> str:
        """
        Download PDF from IACR ePrint Archive
    
        Args:
            paper_id: IACR paper ID (e.g., "2025/1014")
            save_path: Path to save the PDF
    
        Returns:
            str: Path to downloaded file or error message
        """
        try:
            os.makedirs(save_path, exist_ok=True)
            pdf_url = f"{self.IACR_BASE_URL}/{paper_id}.pdf"
    
            response = self.session.get(pdf_url)
    
            if response.status_code == 200:
                filename = f"{save_path}/iacr_{paper_id.replace('/', '_')}.pdf"
                with open(filename, "wb") as f:
                    f.write(response.content)
                return filename
            else:
                return f"Failed to download PDF: HTTP {response.status_code}"
    
        except Exception as e:
            logger.error(f"PDF download error: {e}")
            return f"Error downloading PDF: {e}"
  • Instantiation of the IACRSearcher instance used by the tool handlers.
    iacr_searcher = IACRSearcher()
    cryptobib_searcher = CryptoBibSearcher(cache_dir="./downloads")
    crossref_searcher = CrossrefSearcher()
    google_scholar_searcher = GoogleScholarSearcher()
  • Imports for the platform searchers including IACRSearcher.
    from apaper.platforms import (
        IACRSearcher,
        CryptoBibSearcher,
        CrossrefSearcher,
        GoogleScholarSearcher
    )
    from apaper.utils.pdf_reader import read_pdf

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