search-arxiv
Search arXiv for academic articles using keywords to find relevant research papers and scholarly publications.
Instructions
Search arxiv for articles related to the given keyword.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes |
Implementation Reference
- src/mcp_scholarly/arxiv_search.py:37-39 (handler)Main handler function that orchestrates the arXiv search and result formatting.def search(self, keyword, max_results=10) -> List[str]: results = self.arxiv_search(keyword, max_results) return self._parse_results(results)
- src/mcp_scholarly/arxiv_search.py:11-15 (handler)Core search logic using arxiv.Client to query arXiv API.def arxiv_search(self, keyword, max_results=10): search = arxiv.Search(query=keyword, max_results=max_results, sort_by=arxiv.SortCriterion.SubmittedDate) results = self.client.results(search) all_results = list(results) return all_results
- src/mcp_scholarly/server.py:65-67 (handler)Tool dispatch in MCP server that instantiates ArxivSearch and calls its search method.if name == "search-arxiv": arxiv_search = ArxivSearch() formatted_results = arxiv_search.search(keyword)
- src/mcp_scholarly/server.py:18-28 (registration)Tool registration in list_tools handler, including name, description, and JSON schema for input validation.types.Tool( name="search-arxiv", description="Search arxiv for articles related to the given keyword.", inputSchema={ "type": "object", "properties": { "keyword": {"type": "string"}, }, "required": ["keyword"], }, ),
- Helper function to format arXiv search results into readable text strings.@staticmethod def _parse_results(results): formatted_results = [] for result in results: title = result.title summary = result.summary links = "||".join([link.href for link in result.links]) pdf_url = result.pdf_url article_data = "\n".join([ f"Title: {title}", f"Summary: {summary}", f"Links: {links}", f"PDF URL: {pdf_url}", ]) formatted_results.append(article_data) return formatted_results