load_article_to_context
Load arXiv article content into LLM context by searching with the article title, enabling analysis of scholarly papers.
Instructions
Load the article hosted on arXiv.org into context. This tool searches for the article based on its title, retrieves the article content, and loads text content into LLM context.
Args: title: Article title.
Returns: Article as a text string or error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes |
Implementation Reference
- src/arxiv_server/server.py:155-178 (handler)The handler function decorated with @mcp.tool(), implementing the core logic: searches arXiv by title, downloads PDF, extracts full text using PyMuPDF (fitz), and returns the article content as a string.@mcp.tool() async def load_article_to_context(title: str) -> str: """ Load the article hosted on arXiv.org into context. This tool searches for the article based on its title, retrieves the article content, and loads text content into LLM context. Args: title: Article title. Returns: Article as a text string or error message. """ result = await get_url_and_arxiv_id(title) if isinstance(result, str): return result article_url, _ = result pdf_doc = await get_pdf(article_url) if pdf_doc is None: return "Unable to retrieve the article from arXiv.org." pymupdf_doc = fitz.open(stream=pdf_doc, filetype="pdf") content = "" for page in pymupdf_doc: content += page.get_text() return content