get_details
Retrieve article metadata from arXiv using title or arXiv ID to access publication details for research and analysis.
Instructions
Retrieve metadata of an article by title or arXiv ID.
Args: title: Article title. arxiv_id: arXiv ID.
Returns: JSON string containing article details or structured error JSON.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| arxiv_id | No |
Implementation Reference
- src/arxiv_server/server.py:292-343 (handler)The handler function for the 'get_details' MCP tool. It fetches and formats arXiv article metadata as JSON, using either title or arXiv ID.@mcp.tool() async def get_details(title: Optional[str] = None, arxiv_id: Optional[str] = None) -> str: """ Retrieve metadata of an article by title or arXiv ID. Args: title: Article title. arxiv_id: arXiv ID. Returns: JSON string containing article details or structured error JSON. """ if arxiv_id: # Quick path via ID res = await resolve_article(arxiv_id=arxiv_id) if isinstance(res, str): return res _, vid = res # Fetch the /abs entry for richer fields params = {"search_query": f"id:{vid}", "start": 0, "max_results": 1} data = await make_api_call(f"{ARXIV_API_BASE}/query", params=params) if data is None: return _error("API_ERROR", "Unable to retrieve data from arXiv.org.") feed = feedparser.parse(data) if not feed.entries: return _error("NOT_FOUND", f"No metadata for {vid}") info = feed.entries[0] else: info = await fetch_information(title or "") if isinstance(info, str): return _error("NOT_FOUND", str(info)) entry_id = info.id link = info.link article_title = info.title authors = [author["name"] for author in info.authors] vid = entry_id.split("/abs/")[-1] direct_pdf_url = f"https://arxiv.org/pdf/{vid}" updated = getattr(info, "updated", "Unknown") published = getattr(info, "published", "Unknown") summary = getattr(info, "summary", "Unknown") info_dict = { "arXiv ID": vid, "Title": article_title, "Authors": authors, "Link": link, "Direct PDF URL": direct_pdf_url, "Published": published, "Updated": updated, "Summary": summary, } return json.dumps(info_dict)