Skip to main content
Glama

get_stats

Retrieve statistics about the Retrieval-Augmented Generation system's performance and usage metrics to monitor and analyze its operational data.

Instructions

Get statistics about the RAG system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_stats': fetches statistics from RAGService and formats as JSON response.
    private async handleGetStats() {
      const stats = await this.ragService.getStats();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(stats, null, 2),
          },
        ],
      };
  • src/index.ts:188-195 (registration)
    Tool registration in ListToolsRequestHandler, including name, description, and empty input schema.
    {
      name: 'get_stats',
      description: 'Get statistics about the RAG system',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Input schema for 'get_stats' tool (no required parameters).
    inputSchema: {
      type: 'object',
      properties: {},
    },
  • RAGService.getStats() method that delegates to vectorDatabase for collection statistics.
    async getStats(): Promise<{
      documents: number;
      memory: number;
      total: number;
    }> {
      try {
        return await this.vectorDatabase.getCollectionStats();
      } catch (error) {
        logger.error(`Error getting stats: ${error}`);
        return { documents: 0, memory: 0, total: 0 };
      }
    }

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/santis84/mcp-rag'

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