list_documents
Retrieve indexed documents from a local RAG system, with optional filtering by category to organize your knowledge base.
Instructions
List all indexed documents, optionally filtered by category.
Args:
category: Optional category filterInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No |
Implementation Reference
- mcp_server/server.py:1226-1240 (handler)The method in KnowledgeOrchestrator that retrieves the list of documents from the internal _indexed_docs metadata.
def list_documents(self, category: Optional[str] = None) -> List[Dict[str, str]]: """List all indexed documents, optionally filtered by category""" docs = [] for doc_id, info in self._indexed_docs.items(): if category and info.get("category") != category: continue docs.append({ "id": doc_id, "source": info.get("source", ""), "category": info.get("category", ""), "format": info.get("format", ""), "chunks": info.get("chunks", 0), "keywords": info.get("keywords", [])[:5] }) return docs - mcp_server/server.py:1397-1408 (registration)The MCP tool registration for 'list_documents', which wraps the KnowledgeOrchestrator.list_documents method.
@mcp.tool() def list_documents(category: str = None) -> str: """ List all indexed documents, optionally filtered by category. Args: category: Optional category filter """ orchestrator = get_orchestrator() docs = orchestrator.list_documents(category=category) return json.dumps({"status": "success", "filter": category or "all", "count": len(docs), "documents": docs}, indent=2, ensure_ascii=False)