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
| Name | Required | Description | Default |
|---|---|---|---|
| paper_id | Yes | ||
| save_path | No | ./downloads |
Implementation Reference
- src/apaper/server.py:104-122 (registration)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)}"
- src/apaper/platforms/iacr.py:207-235 (handler)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}"
- src/apaper/server.py:25-28 (helper)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()
- src/apaper/server.py:13-19 (helper)Imports for the platform searchers including IACRSearcher.from apaper.platforms import ( IACRSearcher, CryptoBibSearcher, CrossrefSearcher, GoogleScholarSearcher ) from apaper.utils.pdf_reader import read_pdf