get_cache_stats
Retrieve statistics about cached data to monitor usage and optimize token efficiency in the Memory Cache MCP Server.
Instructions
Get cache statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:230-240 (handler)Handler for the 'get_cache_stats' tool call. Retrieves cache statistics using CacheManager.getStats() and returns them as formatted JSON text content.case 'get_cache_stats': { const stats = this.cacheManager.getStats(); return { content: [ { type: 'text', text: JSON.stringify(stats, null, 2), }, ], }; }
- src/index.ts:148-156 (registration)Registration of the 'get_cache_stats' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema (no required parameters).{ 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 get_cache_stats tool.export interface CacheStats { totalEntries: number; memoryUsage: number; hits: number; misses: number; hitRate: number; avgAccessTime: number; }
- src/CacheManager.ts:107-109 (helper)Helper method in CacheManager class that returns a shallow copy of the current cache statistics object.getStats(): CacheStats { return { ...this.stats }; }