Skip to main content
Glama

get_arxiv_pdf_url

Extract direct PDF download links from arXiv paper URLs or IDs to access academic research documents.

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 takes an arXiv URL or ID and returns the corresponding PDF download URL.
    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)}`); } }
  • The input schema and metadata definition for the 'get_arxiv_pdf_url' tool, registered in the ListTools handler.
    { 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)
    The registration block in the main CallToolRequestSchema handler that dispatches to the getArxivPdfUrl function and formats the response.
    case "get_arxiv_pdf_url": { const { input } = args as { input: string }; const pdfUrl = getArxivPdfUrl(input); return { content: [{ type: "text", text: `PDF 下载链接: ${pdfUrl}` }] }; }
  • Usage of getArxivPdfUrl as a helper function within the parse_paper_content tool.
    const pdfUrl = getArxivPdfUrl(input);

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/BACH-AI-Tools/bach-Arxiv-Paper-MCP'

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