download_iacr
Download free PDFs from IACR ePrint using paper IDs like '2024/123' to access cryptographic research papers directly.
Instructions
Download PDF from IACR ePrint (always free).
Args:
paper_id: IACR ID (e.g., '2024/123', '2009/101').
save_path: Directory to save PDF.
Returns:
Path to downloaded PDF.
Example:
download_iacr("2024/123")
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paper_id | Yes | ||
| save_path | No |
Implementation Reference
- paper_find_mcp/server.py:510-524 (handler)MCP tool handler and registration for download_iacr. Defines input schema via type hints and docstring, delegates to generic _download using 'iacr' searcher.@mcp.tool() async def download_iacr(paper_id: str, save_path: Optional[str] = None) -> str: """Download PDF from IACR ePrint (always free). Args: paper_id: IACR ID (e.g., '2024/123', '2009/101'). save_path: Directory to save PDF. Returns: Path to downloaded PDF. Example: download_iacr("2024/123") """ return await _download('iacr', paper_id, save_path)
- Exact implementation of the PDF download logic in IACRSearcher class, constructing the PDF URL and performing the HTTP download.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: 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}"
- paper_find_mcp/server.py:115-135 (helper)Generic download helper function that dispatches to the specific platform's searcher.download_pdf method.async def _download( searcher_name: str, paper_id: str, save_path: Optional[str] = None ) -> str: """通用下载函数""" if save_path is None: save_path = get_download_path() searcher = SEARCHERS.get(searcher_name) if not searcher: return f"Error: Unknown searcher {searcher_name}" try: return searcher.download_pdf(paper_id, save_path) except NotImplementedError as e: return str(e) except Exception as e: logger.error(f"Download failed for {searcher_name}: {e}") return f"Error downloading: {str(e)}"
- paper_find_mcp/server.py:75-85 (helper)Global SEARCHERS dictionary that instantiates and provides the IACRSearcher instance under the 'iacr' key for use by download handlers.SEARCHERS = { 'arxiv': ArxivSearcher(), 'pubmed': PubMedSearcher(), 'biorxiv': BioRxivSearcher(), 'medrxiv': MedRxivSearcher(), 'google_scholar': GoogleScholarSearcher(), 'iacr': IACRSearcher(), 'semantic': SemanticSearcher(), 'crossref': CrossRefSearcher(), 'repec': RePECSearcher(), }