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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/tools.ts:1272-1301 (handler)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}` }], - src/handlers/tools.ts:233-240 (registration)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: {} } },