Skip to main content
Glama
openags

Paper Search MCP

by openags

download_arxiv

Download PDFs of arXiv research papers by providing the paper ID, with options to specify the save directory for organized storage.

Instructions

Download PDF of an arXiv paper.

Args: paper_id: arXiv paper ID (e.g., '2106.12345'). save_path: Directory to save the PDF (default: './downloads'). Returns: Path to the downloaded PDF file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
save_pathNo./downloads

Implementation Reference

  • The 'download_arxiv' tool handler in the MCP server, which delegates the download task to the 'arxiv_searcher' instance.
    @mcp.tool()
    async def download_arxiv(paper_id: str, save_path: str = "./downloads") -> str:
        """Download PDF of an arXiv paper.
    
        Args:
            paper_id: arXiv paper ID (e.g., '2106.12345').
            save_path: Directory to save the PDF (default: './downloads').
        Returns:
            Path to the downloaded PDF file.
        """
        return await asyncio.to_thread(arxiv_searcher.download_pdf, paper_id, save_path)
  • The implementation of 'download_pdf' method in ArxivSearcher, which performs the actual HTTP request to download the PDF.
    def download_pdf(self, paper_id: str, save_path: str) -> str:
        pdf_url = f"https://arxiv.org/pdf/{paper_id}.pdf"
        response = requests.get(pdf_url)
        os.makedirs(save_path, exist_ok=True)
        output_file = f"{save_path}/{paper_id}.pdf"
        with open(output_file, 'wb') as f:
            f.write(response.content)
        return output_file

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/openags/paper-search-mcp'

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