list_categories
Retrieve all document categories and their associated document counts to organize and navigate your knowledge base.
Instructions
List all document categories with their document counts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_server/server.py:1390-1396 (handler)The 'list_categories' tool definition and handler. It invokes 'orchestrator.list_categories()' and returns the categories and their document counts as a JSON string.
def list_categories() -> str: """List all document categories with their document counts.""" orchestrator = get_orchestrator() categories = orchestrator.list_categories() return json.dumps({"status": "success", "categories": categories, "total_documents": sum(categories.values())}, indent=2) - mcp_server/server.py:1218-1224 (handler)The 'KnowledgeOrchestrator.list_categories' method which iterates over indexed documents to compute document counts per category.
def list_categories(self) -> Dict[str, int]: """List all categories with document counts""" categories = {} for doc_info in self._indexed_docs.values(): cat = doc_info.get("category", "unknown") categories[cat] = categories.get(cat, 0) + 1 return categories