get_collection_cache_health
Monitor the health and performance of the collection cache system to ensure offline browsing functionality and identify potential issues. Supports effective cache management.
Instructions
Get health status and statistics for the collection cache system. This helps monitor cache performance and identify any issues with offline browsing capability.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server/tools/CollectionTools.ts:147-157 (registration)Registration of the get_collection_cache_health tool including name, description, empty input schema, and handler function that delegates to the server's getCollectionCacheHealth method.{ tool: { name: "get_collection_cache_health", description: "Get health status and statistics for the collection cache system. This helps monitor cache performance and identify any issues with offline browsing capability.", inputSchema: { type: "object", properties: {} } }, handler: () => server.getCollectionCacheHealth() }
- src/server/types.ts:40-40 (schema)Interface definition for IToolHandler declaring the getCollectionCacheHealth method signature.getCollectionCacheHealth(): Promise<any>;
- src/cache/CollectionCache.ts:193-204 (helper)CollectionCache.getCacheStats() provides basic health statistics (itemCount, cacheAge, isValid) likely used by the tool's underlying server method.async getCacheStats(): Promise<{ itemCount: number; cacheAge: number; isValid: boolean }> { const cache = await this.loadCache(); if (!cache) { return { itemCount: 0, cacheAge: 0, isValid: false }; } return { itemCount: cache.items.length, cacheAge: Date.now() - cache.timestamp, isValid: Date.now() - cache.timestamp <= this.CACHE_TTL_MS }; }
- CollectionIndexCache.getCacheStats() provides comprehensive cache health metrics including validity, age, element count, memory cache stats, and performance metrics.getCacheStats(): { isValid: boolean; age: number; hasCache: boolean; elements: number; memoryCache: any; performanceMetrics: any; } { if (!this.cache) { return { isValid: false, age: 0, hasCache: false, elements: 0, memoryCache: this.memoryCache.getStats(), performanceMetrics: null }; } const age = Date.now() - this.cache.fetchedAt.getTime(); return { isValid: this.isValid(), age, hasCache: true, elements: this.cache.data.total_elements, memoryCache: this.memoryCache.getStats(), performanceMetrics: { cacheHitRate: this.calculateCacheHitRate(), averageAccessTime: this.calculateAverageAccessTime() } }; }