Skip to main content
Glama
andybrandt

mcp-simple-arxiv

by andybrandt

list_categories

Retrieve available arXiv categories to identify relevant research topics and optimize paper searches using category codes.

Instructions

List all available arXiv categories and how to use them in search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
primary_categoryNo

Implementation Reference

  • Registration of the list_categories tool using the @app.tool decorator from FastMCP, including tool annotations.
    @app.tool( annotations={ "title": "List arXiv Categories", "readOnlyHint": True, "openWorldHint": False } ) def list_categories(primary_category: str = None) -> str:
  • The handler function that implements the logic for the list_categories tool. It loads the taxonomy and formats the categories list, optionally filtered by primary_category.
    def list_categories(primary_category: str = None) -> str: """List all available arXiv categories and how to use them in search.""" try: taxonomy = load_taxonomy() except Exception as e: logger.error(f"Error loading taxonomy: {e}") return f"Error loading category taxonomy. Try using update_categories tool to refresh it." result = "arXiv Categories:\n\n" for primary, data in taxonomy.items(): if primary_category and primary != primary_category: continue result += f"{primary}: {data['name']}\n" for code, desc in data['subcategories'].items(): result += f" {primary}.{code}: {desc}\n" result += "\n" result += "\nUsage in search:\n" result += '- Search in specific category: cat:cs.AI\n' result += '- Combine with other terms: "neural networks" AND cat:cs.AI\n' result += '- Multiple categories: (cat:cs.AI OR cat:cs.LG)\n' result += '\nNote: If categories seem outdated, use the update_categories tool to refresh them.\n' return result
  • Supporting helper function load_taxonomy used by the list_categories handler to retrieve category taxonomy data from file or generate it.
    def load_taxonomy() -> dict: """ Load taxonomy from the JSON file. If file doesn't exist, create it from built-in categories. """ if not TAXONOMY_FILE.exists(): print(f"Taxonomy file not found at {TAXONOMY_FILE}, creating it...") return update_taxonomy_file() print(f"Loading taxonomy from {TAXONOMY_FILE}") with open(TAXONOMY_FILE, 'r', encoding='utf-8') as f: return json.load(f)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andybrandt/mcp-simple-arxiv'

If you have feedback or need assistance with the MCP directory API, please join our Discord server