Skip to main content
Glama
emi-dm

ArxivSearcher MCP Server

by emi-dm

download_paper

Download PDFs of arXiv papers to a local directory using the paper's arXiv ID for offline access or analysis.

Instructions

Downloads the PDF of a paper to a local directory on the server. NOTE: In a stateless/free hosting environment, this file is temporary and will be deleted when the server restarts or sleeps.

:param arxiv_id: The ArXiv ID of the paper to download (e.g., '2301.12345'). :param directory: The local directory where the paper will be saved.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
arxiv_idYes
directoryNodownloaded_papers

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Synchronous handler function for the 'download_paper' MCP tool. Downloads arXiv paper PDF to a local directory using the arxiv library.
    @mcp.tool
    def download_paper(arxiv_id: str, directory: str = "downloaded_papers") -> dict:
        """
        Downloads the PDF of a paper to a local directory on the server.
        NOTE: In a stateless/free hosting environment, this file is temporary and
        will be deleted when the server restarts or sleeps.
    
        :param arxiv_id: The ArXiv ID of the paper to download (e.g., '2301.12345').
        :param directory: The local directory where the paper will be saved.
        """
        try:
            # Ensure the download directory exists
            os.makedirs(directory, exist_ok=True)
            
            search = arxiv.Search(id_list=[arxiv_id])
            paper = next(search.results())
            
            # Define a clean filename to avoid issues with special characters
            clean_id = re.sub(r'[^0-9v.]', '_', arxiv_id)
            filename = f"{clean_id}.pdf"
            
            # Download the paper to the specified directory
            paper.download_pdf(dirpath=directory, filename=filename)
            
            filepath = os.path.join(directory, filename)
            logging.info(f"Paper {arxiv_id} downloaded to {filepath}")
            
            return {
                "success": True,
                "arxiv_id": arxiv_id,
                "local_path": filepath,
                "message": f"Paper is temporarily available at the server path: {filepath}"
            }
            
        except StopIteration:
            logging.error(f"Paper with ID {arxiv_id} not found.")
            return {"success": False, "error": f"Paper with ID {arxiv_id} not found."}
        except Exception as e:
            logging.error(f"Failed to download paper {arxiv_id}: {e}")
            return {"success": False, "error": f"An unexpected error occurred: {str(e)}"}
  • Asynchronous handler function for the 'download_paper' MCP tool in the remote version. Downloads arXiv paper PDF to a local directory using the arxiv library.
    @mcp.tool
    async def download_paper(arxiv_id: str, directory: str = "downloaded_papers") -> dict:
        """
        Downloads the PDF of a paper to a local directory on the server.
        NOTE: In a stateless/free hosting environment, this file is temporary and
        will be deleted when the server restarts or sleeps.
    
        :param arxiv_id: The ArXiv ID of the paper to download (e.g., '2301.12345').
        :param directory: The local directory where the paper will be saved.
        """
        try:
            # Ensure the download directory exists
            os.makedirs(directory, exist_ok=True)
            
            search = arxiv.Search(id_list=[arxiv_id])
            paper = next(search.results())
            
            # Define a clean filename to avoid issues with special characters
            clean_id = re.sub(r'[^0-9v.]', '_', arxiv_id)
            filename = f"{clean_id}.pdf"
            
            # Download the paper to the specified directory
            paper.download_pdf(dirpath=directory, filename=filename)
            
            filepath = os.path.join(directory, filename)
            logging.info(f"Paper {arxiv_id} downloaded to {filepath}")
            
            return {
                "success": True,
                "arxiv_id": arxiv_id,
                "local_path": filepath,
                "message": f"Paper is temporarily available at the server path: {filepath}"
            }
            
        except StopIteration:
            logging.error(f"Paper with ID {arxiv_id} not found.")
            return {"success": False, "error": f"Paper with ID {arxiv_id} not found."}
        except Exception as e:
            logging.error(f"Failed to download paper {arxiv_id}: {e}")
            return {"success": False, "error": f"An unexpected error occurred: {str(e)}"}
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively explains key behaviors: the file is saved locally, and in stateless environments, it's temporary and will be deleted on server restart/sleep. This covers important operational constraints, though it doesn't mention error handling, rate limits, or authentication needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a critical behavioral note, then parameter details. Every sentence adds value: the purpose, the temporary file warning, and parameter explanations. No wasted words, and the structure logically progresses from what to why to how.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with 0% schema coverage and no annotations, the description does an excellent job explaining parameters and key behavioral traits (temporary files). The presence of an output schema means return values don't need description. It could slightly improve by mentioning error cases (e.g., invalid IDs) or success confirmation, but it's largely complete for this tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully compensate. It adds crucial semantic context for both parameters: 'arxiv_id' is explained with an example format ('e.g., '2301.12345''), and 'directory' specifies the save location and includes a default value mention. This goes well beyond the bare schema, making parameter usage clear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Downloads the PDF of a paper') and resource ('paper'), distinguishing it from sibling tools like 'get_paper_details' (which likely retrieves metadata) or 'search_papers' (which searches). It explicitly mentions the output format (PDF) and destination (local directory), making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a PDF download is needed, but provides no explicit guidance on when to use this tool versus alternatives like 'get_paper_details' (which might return metadata without download) or 'export_search_results' (which could export search data). The note about temporary files in stateless environments offers some context but doesn't address tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/emi-dm/Arxiv-MCP'

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