get_cache_stats
Retrieve performance metrics and usage data from the Memory Cache Server to monitor token optimization and cache efficiency during language model interactions.
Instructions
Get cache statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:230-240 (handler)Main handler for the 'get_cache_stats' tool: calls CacheManager.getStats() and formats response as JSON text.case 'get_cache_stats': { const stats = this.cacheManager.getStats(); return { content: [ { type: 'text', text: JSON.stringify(stats, null, 2), }, ], }; }
- src/CacheManager.ts:107-109 (helper)Core implementation: returns a shallow copy of the cache statistics object.getStats(): CacheStats { return { ...this.stats }; }
- src/index.ts:149-155 (registration)Registers the 'get_cache_stats' tool in the MCP tools list with empty input schema (no parameters). Note: opening brace on line 148.name: 'get_cache_stats', description: 'Get cache statistics', inputSchema: { type: 'object', properties: {}, }, },
- src/types.ts:9-16 (schema)TypeScript interface defining the structure of cache statistics returned by the tool.export interface CacheStats { totalEntries: number; memoryUsage: number; hits: number; misses: number; hitRate: number; avgAccessTime: number; }