Skip to main content
Glama

get_index_stats

Retrieve statistics about the knowledge base index to monitor its size, structure, and content distribution for RAG system management.

Instructions

Get statistics about the knowledge base index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_stats method within the KnowledgeOrchestrator class calculates and returns the index statistics.
    def get_stats(self) -> Dict[str, Any]:
        """Get index statistics"""
        return {
            "total_documents": len(self._indexed_docs),
            "total_chunks": self.collection.count(),
            "unique_content_hashes": len(self._chunk_hashes),
            "categories": self.list_categories(),
            "supported_formats": config.supported_formats,
            "embedding_model": config.embedding_model,
            "embedding_dim": config.embedding_dim,
            "reranker_model": config.reranker_model if config.reranker_enabled else "disabled",
            "chunk_size": config.chunk_size,
            "chunk_overlap": config.chunk_overlap,
            "query_cache": self.query_cache.stats(),
        }
  • Registration of the get_index_stats MCP tool, which calls the orchestrator's get_stats method.
    def get_index_stats() -> str:
        """Get statistics about the knowledge base index."""
        orchestrator = get_orchestrator()
        stats = orchestrator.get_stats()
        return json.dumps({"status": "success", "stats": stats}, indent=2)

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