Skip to main content
Glama

get_article_url

Retrieve the arXiv.org URL for a scholarly article by searching with its title. Use this tool to obtain direct links to academic papers for access or citation.

Instructions

Retrieve the URL of an article hosted on arXiv.org based on its title. Use this tool only for retrieving the URL. This tool searches for the article based on its title, and then fetches the corresponding URL from arXiv.org.

Args: title: Article title.

Returns: URL that can be used to retrieve the article.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • The handler function for the 'get_article_url' tool. Registered via @mcp.tool() decorator. It calls get_url_and_arxiv_id to fetch the direct PDF URL for the given article title and returns it or an error message.
    @mcp.tool()
    async def get_article_url(title: str) -> str:
        """
        Retrieve the URL of an article hosted on arXiv.org based on its title. Use this tool only 
        for retrieving the URL. This tool searches for the article based on its title, and then 
        fetches the corresponding URL from arXiv.org.
    
        Args:
            title: Article title.
    
        Returns:
            URL that can be used to retrieve the article.
        """
        result = await get_url_and_arxiv_id(title)
        if isinstance(result, str):
            return result
        article_url, _ = result
        return article_url
  • Helper function that fetches article information and constructs the direct PDF URL and arXiv ID from the title.
    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 query arXiv API by title, parse feed, find best matching entry using fuzzy matching.
    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
  • Helper utility to find the best matching arXiv entry by title similarity using difflib.
    """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
  • Helper function to clean and format the search title text for arXiv API query.
    def format_text(text: str) -> str:
        """Clean a given text string by removing escape sequences and leading and trailing whitespaces."""
        # Remove common escape sequences
        text_without_escapes = re.sub(r'\\[ntr]', ' ', text)  
        # Replace colon with space
        text_without_colon = text_without_escapes.replace(':', ' ')
        # Remove both single quotes and double quotes
        text_without_quotes = re.sub(r'[\'"]', '', text_without_colon)
        # Collapse multiple spaces into one              
        text_single_spaced = re.sub(r'\s+', ' ', text_without_quotes)  
        # Trim leading and trailing spaces    
        cleaned_text = text_single_spaced.strip()
        return cleaned_text
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the behavioral process ('searches for the article based on its title, and then fetches the corresponding URL'), which is helpful. However, it lacks details on error handling, rate limits, or authentication needs, leaving some behavioral aspects unclear for a tool that interacts with an external service.

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 usage guidelines and behavioral details, all in three concise sentences. The Args and Returns sections are structured and add necessary information without redundancy, making every sentence earn its place efficiently.

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 no annotations, 0% schema coverage, and no output schema, the description does well by explaining the tool's purpose, usage, process, and return value. However, it could be more complete by addressing potential issues like what happens if no article is found or if multiple matches exist, which are relevant for a search-based tool.

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 meaningful context by explaining that the 'title' parameter is the 'Article title' used for searching, which clarifies its role beyond the bare schema. However, it doesn't specify format requirements (e.g., exact match vs. partial) or examples, leaving some ambiguity.

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 the URL'), resource ('article hosted on arXiv.org'), and mechanism ('based on its title'). It distinguishes this tool from siblings like download_article (which downloads content) and search_arxiv (which likely returns search results), making the purpose unambiguous and well-differentiated.

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

Usage Guidelines5/5

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

The description provides explicit guidance: 'Use this tool only for retrieving the URL.' This clearly defines when to use it (for URL retrieval) and implies when not to use it (e.g., for downloading content, which is handled by download_article). It effectively distinguishes this tool from alternatives in the sibling list.

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