Skip to main content
Glama

get_article_url

Retrieve direct PDF URLs for arXiv articles using article titles or arXiv IDs to access scholarly papers.

Instructions

Retrieve the direct PDF URL of an article on arXiv.org by title or arXiv ID.

Args: title: Article title. arxiv_id: arXiv ID (e.g., 1706.03762 or arXiv:1706.03762v7).

Returns: URL that can be used to retrieve the article, or structured error JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNo
arxiv_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'get_article_url' tool, registered via @mcp.tool() decorator. It delegates to resolve_article and returns the direct PDF URL or error.
    @mcp.tool()
    async def get_article_url(title: Optional[str] = None, arxiv_id: Optional[str] = None) -> str:
        """
        Retrieve the direct PDF URL of an article on arXiv.org by title or arXiv ID.
    
        Args:
            title: Article title.
            arxiv_id: arXiv ID (e.g., 1706.03762 or arXiv:1706.03762v7).
    
        Returns:
            URL that can be used to retrieve the article, or structured error JSON.
        """
        result = await resolve_article(title=title, arxiv_id=arxiv_id)
        if isinstance(result, str):
            return result
        article_url, _ = result
        return article_url
  • Key helper function that resolves the article identifier (title or arXiv ID) to a direct PDF URL and ID, handling validation, API calls for title search, and error conditions.
    async def resolve_article(title: Optional[str] = None, arxiv_id: Optional[str] = None) -> Tuple[str, str] | str:
        """
        Resolve to a direct PDF URL and arXiv ID using either a title or an arXiv ID.
        Preference order: arxiv_id > title.
        """
        if arxiv_id:
            m = ARXIV_ID_RE.match(arxiv_id.strip())
            if not m:
                return _error("INVALID_ID", f"Not a valid arXiv ID: {arxiv_id}")
            vid = m.group("id")
            return (f"https://arxiv.org/pdf/{vid}", vid)
        if not title:
            return _error("MISSING_PARAM", "Provide either 'arxiv_id' or 'title'.")
        info = await fetch_information(title)
        if isinstance(info, str):
            return _error("NOT_FOUND", str(info))
        resolved_id = info.id.split("/abs/")[-1]
        direct_pdf_url = f"https://arxiv.org/pdf/{resolved_id}"
        return (direct_pdf_url, resolved_id)
  • Helper for fetching arXiv article information by title using the arXiv API, parsing feed, and selecting best title match.
    async def fetch_information(title: str):
        """Get information about the article."""
        formatted_title = format_text(title)
        url = f"{ARXIV_API_BASE}/query"
        params = {
            "search_query": f"ti:{formatted_title}",
            "start": 0,
            "max_results": 25,
        }
        data = await make_api_call(url, params=params)
        if data is None:
            return "Unable to retrieve data from arXiv.org."
        feed = feedparser.parse(data)
        error_msg = (
            "Unable to extract information for the provided title. "
            "This issue may stem from an incorrect or incomplete title, "
            "or because the work has not been published on arXiv."
        )
        if not feed.entries:
            return error_msg
        best_match = find_best_match(target_title=formatted_title, entries=feed.entries)
        if best_match is None:
            return str(error_msg)
        return best_match
  • Utility helper to find the best matching arXiv entry by title similarity using difflib.
    def find_best_match(target_title: str, entries: list, threshold: float = 0.8):
        """Find the entry whose title best matches the target title."""
        target_title_lower = target_title.lower()
        best_entry = None
        best_score = 0.0
        for entry in entries:
            entry_title_lower = entry.title.lower()
            score = difflib.SequenceMatcher(None, target_title_lower, entry_title_lower).ratio()
            if score > best_score:
                best_score = score
                best_entry = entry
        if best_score >= threshold:
            return best_entry
        return None
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the return behavior ('URL that can be used to retrieve the article, or structured error JSON'), which is helpful, but does not mention rate limits, authentication needs, or other operational traits like response formats or error handling details beyond the basic return statement.

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, followed by structured sections for Args and Returns. Every sentence adds value: the first states the action, the second explains parameters, and the third specifies outputs, with no redundant information.

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 the tool's moderate complexity (2 parameters, no annotations, but with an output schema), the description is mostly complete. It covers purpose, parameters, and return values, but lacks details on behavioral aspects like error conditions or usage prerequisites. The output schema likely handles return structure, so the description's focus on semantics is adequate.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'title' is the article title and 'arxiv_id' is the arXiv ID with examples (e.g., 1706.03762 or arXiv:1706.03762v7), clarifying usage beyond the schema's basic types. However, it does not detail constraints like format requirements or mutual exclusivity.

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 ('Retrieve'), resource ('direct PDF URL of an article on arXiv.org'), and scope ('by title or arXiv ID'), distinguishing it from siblings like download_article (which downloads content) or get_details (which provides metadata).

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'by title or arXiv ID,' but does not explicitly state when to use this tool versus alternatives like search_arxiv (for broader searches) or load_article_to_context (for loading content). It provides clear input options but lacks explicit exclusions or comparisons.

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

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