Skip to main content
Glama

download_paper

Download cryptographic research papers from the IACR Cryptology ePrint Archive in PDF or TXT formats by specifying the paper ID and desired format.

Instructions

Download a paper in PDF or TXT format

Input Schema

NameRequiredDescriptionDefault
formatNopdf
paper_idYes

Input Schema (JSON Schema)

{ "properties": { "format": { "default": "pdf", "enum": [ "pdf", "txt" ], "type": "string" }, "paper_id": { "type": "string" } }, "required": [ "paper_id" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'download_paper' tool. It validates input using DownloadPaperSchema, fetches the paper from eprint.iacr.org in the specified format (pdf or txt), encodes it as base64, and returns it as a file artifact.
    private async downloadPaper(args: unknown) { const validatedArgs = DownloadPaperSchema.parse(args); try { const response = await axios.get(`https://eprint.iacr.org/${validatedArgs.paper_id}.${validatedArgs.format}`, { responseType: 'arraybuffer' }); return { content: [{ type: 'file', name: `${validatedArgs.paper_id}.${validatedArgs.format}`, data: response.data.toString('base64') }] }; } catch (error) { console.error('Paper Download Error:', error); throw new McpError( ErrorCode.InternalError, `Paper download failed: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • Zod schema defining the input parameters for the download_paper tool: paper_id (required string), format (optional enum ['pdf', 'txt'] defaulting to 'pdf'). Used for validation in the handler.
    const DownloadPaperSchema = z.object({ paper_id: z.string(), format: z.enum(['pdf', 'txt']).optional().default('pdf') });
  • src/index.ts:92-107 (registration)
    Tool registration in the ListTools response, providing the name 'download_paper', description, and inputSchema matching the Zod schema.
    { name: 'download_paper', description: 'Download a paper in PDF or TXT format', inputSchema: { type: 'object', properties: { paper_id: { type: 'string' }, format: { type: 'string', enum: ['pdf', 'txt'], default: 'pdf' } }, required: ['paper_id'] } }
  • src/index.ts:118-119 (registration)
    Dispatch logic in the CallTool request handler switch statement that routes 'download_paper' calls to the downloadPaper method.
    case 'download_paper': return this.downloadPaper(request.params.arguments);

Other Tools

Related Tools

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/doomdagadiggiedahdah/iacr-mcp-server'

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