download_paper
Download PDF files of academic papers from multiple platforms including arXiv, PubMed, and Sci-Hub by providing paper IDs and platform information.
Instructions
Download PDF file of an academic paper
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paperId | Yes | Paper ID (e.g., arXiv ID, DOI for Sci-Hub) | |
| platform | Yes | Platform where the paper is from | |
| savePath | No | Directory to save the PDF file |
Implementation Reference
- src/mcp/handleToolCall.ts:223-238 (handler)Handler function for the 'download_paper' tool. Parses arguments, selects the appropriate platform searcher, validates download capability, calls downloadPdf on the searcher, and returns the saved file path.case 'download_paper': { const { paperId, platform, savePath } = args; const resolvedSavePath = savePath || './downloads'; const searcher = (searchers as any)[platform]; if (!searcher) { throw new Error(`Unsupported platform for download: ${platform}`); } if (!searcher.getCapabilities().download) { throw new Error(`Platform ${platform} does not support PDF download`); } const filePath = await searcher.downloadPdf(paperId, { savePath: resolvedSavePath }); return jsonTextResponse(`PDF downloaded successfully to: ${filePath}`); }
- src/mcp/schemas.ts:109-115 (schema)Zod schema defining input validation for download_paper tool: paperId (required), platform (enum), savePath (optional). Used in parseToolArgs.export const DownloadPaperSchema = z .object({ paperId: z.string().min(1), platform: z.enum(['arxiv', 'biorxiv', 'medrxiv', 'semantic', 'iacr', 'scihub', 'springer', 'wiley']), savePath: z.string().optional() }) .strip();
- src/mcp/tools.ts:249-268 (registration)MCP tool registration in TOOLS array, including name, description, and inputSchema matching the Zod schema.{ name: 'download_paper', description: 'Download PDF file of an academic paper', inputSchema: { type: 'object', properties: { paperId: { type: 'string', description: 'Paper ID (e.g., arXiv ID, DOI for Sci-Hub)' }, platform: { type: 'string', enum: ['arxiv', 'biorxiv', 'medrxiv', 'semantic', 'iacr', 'scihub', 'springer', 'wiley'], description: 'Platform where the paper is from' }, savePath: { type: 'string', description: 'Directory to save the PDF file' } }, required: ['paperId', 'platform'] } },