fetch_paper_details_from_arxiv
Fetch detailed information for research papers from arXiv using their unique IDs. Ideal for gathering metadata, abstracts, and other essential details to discuss or organize scientific literature.
Instructions
Get the Arxiv info for a list of papers.
Args:
arxiv_ids (list[str] | str): The IDs of the papers to get the Arxiv info for, e.g. ["2503.01469", "2503.01470"]
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arxiv_ids | Yes |
Implementation Reference
- paperpal.py:34-42 (handler)The primary handler function for the 'fetch_paper_details_from_arxiv' tool. Decorated with @mcp.tool() for registration and execution. Fetches paper details via helper and formats output.@mcp.tool() async def fetch_paper_details_from_arxiv(arxiv_ids: list[str] | str) -> str: """Get the Arxiv info for a list of papers. Args: arxiv_ids (list[str] | str): The IDs of the papers to get the Arxiv info for, e.g. ["2503.01469", "2503.01470"] """ arxiv_papers: list[ArxivPaper] = await get_arxiv_info_from_arxiv_ids(arxiv_ids) return stringify_papers(arxiv_papers)
- arxiv.py:5-20 (schema)Pydantic schema (BaseModel) defining the structure of individual Arxiv paper details, used internally for parsing and output formatting in the tool.class ArxivPaper(BaseModel): title: str | None = None summary: str | None = None authors: list[str] | None = None categories: list[str] | None = None arxiv_id: str | None = None url: str | None = None raw_arxiv_info: str | None = None error_message: str | None = None def __str__(self) -> str: if self.error_message: return f"Error: {self.error_message}" else: return self.raw_arxiv_info
- paperpal.py:11-15 (helper)Helper utility to convert list of paper objects (ArxivPaper or HuggingFacePaper) into a formatted string, used by the tool handler for output.def stringify_papers(papers: list[ArxivPaper | HuggingFacePaper]) -> str: """Format a list of papers into a string.""" papers_str = "\n---\n".join([str(paper) for paper in papers]) return f"List of papers:\n---\n{papers_str}\n---\n"
- arxiv.py:127-140 (helper)Key helper function that orchestrates batched asynchronous fetching of Arxiv paper details from arxiv-txt.org API, directly invoked by the tool handler.async def get_arxiv_info_from_arxiv_ids(arxiv_ids: list[str], batch_size: int = 5) -> list[str]: """Get the Arxiv info for a list of papers concurrently, processing in batches. Args: arxiv_ids list[str]: The IDs of the papers to get the Arxiv info for, e.g. ["2503.01469", "2503.01470"] batch_size (int): Number of papers to process concurrently in each batch. Defaults to 5. Returns: list[str]: List of Arxiv info for all papers, in the same order as input paper_ids """ if isinstance(arxiv_ids, list): return await get_arxiv_info_batch(arxiv_ids, batch_size) else: raise ValueError("arxiv_ids must be a list of strings")