Skip to main content
Glama

download_article

Download arXiv articles as PDF files by providing the article title. The tool searches for the article, retrieves the PDF, and saves it locally using the arXiv ID as the filename.

Instructions

Download the article hosted on arXiv.org as a PDF file. This tool searches for the article based on its title, retrieves the article's PDF, and saves it to a specified download location using the arXiv ID as the filename.

Args: title: Article title.

Returns: Success or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • The main execution logic for the 'download_article' MCP tool. It finds the arXiv PDF URL from the title, downloads the PDF bytes, and saves the file locally using the arXiv ID as the filename.
    @mcp.tool()
    async def download_article(title: str) -> str:
        """
        Download the article hosted on arXiv.org as a PDF file. This tool searches for the article based on its 
        title, retrieves the article's PDF, and saves it to a specified download location using the arXiv ID as 
        the filename.
    
        Args:
            title: Article title.
    
        Returns:
            Success or error message.
        """
        result = await get_url_and_arxiv_id(title)
        if isinstance(result, str):
            return result
        article_url, arxiv_id = result
        pdf_doc = await get_pdf(article_url)
        if pdf_doc is None:
            return "Unable to retrieve the article from arXiv.org."
        file_path = os.path.join(DOWNLOAD_PATH, f"{arxiv_id}.pdf")
        try:
            with open(file_path, "wb") as file:
                file.write(pdf_doc)
            return f"Download successful. Find the PDF at {DOWNLOAD_PATH}"
        except Exception:
            return f"Unable to save the article to local directory."
  • Helper function that searches arXiv API for the article by title, finds the best match, and returns the direct PDF URL and arXiv ID.
    async def get_url_and_arxiv_id(title: str) -> tuple[str, str] | str:
        """Get URL of the article hosted on arXiv.org."""
        info = await fetch_information(title)
        if isinstance(info, str):
            return info
        arxiv_id = info.id.split("/abs/")[-1]
        direct_pdf_url = f"https://arxiv.org/pdf/{arxiv_id}"
        return (direct_pdf_url, arxiv_id)
  • Helper function to fetch the PDF content as bytes from the given arXiv PDF URL.
    async def get_pdf(url: str) -> bytes | None:
        """Get PDF document as bytes from arXiv.org."""
        headers = {
            "User-Agent": USER_AGENT,
            "Accept": "application/pdf"
        }
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, timeout=30.0)
                response.raise_for_status()
                return response.content
            except Exception:
                return None
  • The @mcp.tool() decorator registers the download_article function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden. It describes the download and save behavior but lacks critical details: authentication requirements, rate limits, file size constraints, error handling specifics, or whether the operation is idempotent. The mention of 'arXiv ID as filename' is helpful but insufficient for comprehensive behavioral understanding.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core functionality. The Args/Returns sections are clear but could be integrated more seamlessly. Every sentence contributes meaning, though the structure could be more fluid.

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

Completeness3/5

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

Given no annotations, no output schema, and minimal schema coverage, the description provides basic operational context but lacks sufficient detail for a robust tool. It explains what happens but not how it happens under different conditions, error scenarios, or performance characteristics.

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

Parameters4/5

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

With 0% schema description coverage and only 1 parameter, the description adds significant value by explaining that the 'title' parameter is used to search for the article. However, it doesn't clarify format expectations (exact match vs. partial), search behavior, or what happens with ambiguous titles.

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 tool's purpose with specific verbs ('download', 'searches', 'retrieves', 'saves') and resources ('article hosted on arXiv.org', 'PDF file'). It distinguishes from siblings by specifying the full download process rather than just getting URLs or details.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_article_url', 'search_arxiv', or 'load_article_to_context'. It doesn't mention prerequisites, limitations, or comparative use cases with sibling tools.

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/prashalruchiranga/arxiv-mcp-server'

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