Skip to main content
Glama
yzfly

ArXiv Paper MCP

by yzfly

get_arxiv_pdf_url

Extract direct PDF download links from arXiv paper URLs or IDs to access research papers for reading or citation.

Instructions

获取 arXiv PDF 下载链接

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesarXiv 论文URL(如:http://arxiv.org/abs/2403.15137v1)或 arXiv ID(如:2403.15137v1)

Implementation Reference

  • The core handler function that generates the arXiv PDF URL from either a full arXiv URL (by replacing '/abs/' with '/pdf/') or directly from the arXiv ID.
    function getArxivPdfUrl(input: string): string { try { let arxivId: string; let pdfUrl: string; if (input.startsWith('http://') || input.startsWith('https://')) { const urlParts = input.split('/'); arxivId = urlParts[urlParts.length - 1]; pdfUrl = input.replace('/abs/', '/pdf/') + '.pdf'; } else { arxivId = input; pdfUrl = `http://arxiv.org/pdf/${arxivId}.pdf`; } return pdfUrl; } catch (error) { console.error("获取 PDF 链接时出错:", error); throw new Error(`获取PDF链接失败: ${error instanceof Error ? error.message : String(error)}`); } }
  • Input schema definition specifying the required 'input' parameter as a string (arXiv URL or ID).
    inputSchema: { type: "object", properties: { input: { type: "string", description: "arXiv 论文URL(如:http://arxiv.org/abs/2403.15137v1)或 arXiv ID(如:2403.15137v1)" } }, required: ["input"] }
  • src/index.ts:353-365 (registration)
    Tool metadata registration in ListToolsRequestHandler, including name, description, and input schema.
    name: "get_arxiv_pdf_url", description: "获取 arXiv PDF 下载链接", inputSchema: { type: "object", properties: { input: { type: "string", description: "arXiv 论文URL(如:http://arxiv.org/abs/2403.15137v1)或 arXiv ID(如:2403.15137v1)" } }, required: ["input"] } },
  • src/index.ts:425-435 (registration)
    Tool dispatch registration in CallToolRequestHandler: extracts input, calls the handler function, and returns the PDF URL in the response format.
    case "get_arxiv_pdf_url": { const { input } = args as { input: string }; const pdfUrl = getArxivPdfUrl(input); return { content: [{ type: "text", text: `PDF 下载链接: ${pdfUrl}` }] }; }

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/yzfly/Arxiv-Paper-MCP'

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