Skip to main content
Glama

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 filter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo

Implementation Reference

  • 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
  • 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)

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/lyonzin/knowledge-rag'

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