Skip to main content
Glama

rag_cache_stats

Monitor LAZY-RAG cache performance by retrieving statistics including hits, misses, hit rate, and cache size to optimize retrieval efficiency.

Instructions

Get LAZY-RAG cache statistics - hits, misses, hit rate, cache size

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the rag_cache_stats tool logic.
      private async handleRagCacheStats(_args: any): Promise<CallToolResult> {
        try {
          const rag = getRAGIntegrator();
          const stats = rag.getCacheStats();
    
          const hitRatePercent = (stats.hitRate * 100).toFixed(1);
    
          const output = `πŸ“Š LAZY-RAG Cache Statistics
    
    πŸ“¦ Cache Size: ${stats.size} entries
    βœ… Cache Hits: ${stats.hits}
    ❌ Cache Misses: ${stats.misses}
    πŸ“ˆ Hit Rate: ${hitRatePercent}%
    πŸ”Œ Enabled: ${stats.enabled ? 'Yes' : 'No'}
    
    ${stats.hitRate > 0.5 ? '⚑ Great cache performance!' : stats.size === 0 ? 'πŸ’‘ Cache is empty - queries will populate it' : 'πŸ“ˆ Cache warming up...'}`;
    
          return {
            content: [{
              type: 'text',
              text: output
            }]
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error';
          return {
            content: [{
              type: 'text',
              text: `❌ Failed to get cache stats: ${errorMessage}`
            }],
  • Registration definition for the rag_cache_stats tool.
    {
      name: 'rag_cache_stats',
      description: 'Get LAZY-RAG cache statistics - hits, misses, hit rate, cache size',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },

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/Wolfe-Jam/grok-faf-mcp'

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