list_papers
Access and list all available arXiv papers through the ArXiv MCP Server for streamlined research and resource management.
Instructions
List all existing papers available as resources
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'list_papers' tool. It lists stored paper IDs from the storage directory, fetches metadata from arXiv API, and returns formatted JSON with titles, summaries, authors, etc.async def handle_list_papers( arguments: Optional[Dict[str, Any]] = None, ) -> List[types.TextContent]: """Handle requests to list all stored papers.""" try: papers = list_papers() client = arxiv.Client() results = client.results(arxiv.Search(id_list=papers)) response_data = { "total_papers": len(papers), "papers": [ { "title": result.title, "summary": result.summary, "authors": [author.name for author in result.authors], "links": [link.href for link in result.links], "pdf_url": result.pdf_url, } for result in results ], } return [ types.TextContent(type="text", text=json.dumps(response_data, indent=2)) ] except Exception as e: return [types.TextContent(type="text", text=f"Error: {str(e)}")]
- The schema definition for the 'list_papers' tool, specifying name, description, and empty input schema (no parameters required).list_tool = types.Tool( name="list_papers", description="List all existing papers available as resources", inputSchema={ "type": "object", "properties": {}, "required": [], }, )
- src/arxiv_mcp_server/server.py:41-45 (registration)Registration of the 'list_papers' tool via the list_tools() method, which returns the list_tool schema among other tools when the MCP server lists available tools.@server.list_tools() async def list_tools() -> List[types.Tool]: """List available arXiv research tools.""" return [search_tool, download_tool, list_tool, read_tool]
- Helper function to retrieve the list of stored paper IDs by globbing the storage directory for .md files.def list_papers() -> list[str]: """List all stored paper IDs.""" return [p.stem for p in Path(settings.STORAGE_PATH).glob("*.md")]