Skip to main content
Glama
ibproduct

Memory Cache MCP Server

by ibproduct

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_cache_stats': retrieves statistics from CacheManager instance and returns them as a formatted JSON text response.
    case 'get_cache_stats': { const stats = this.cacheManager.getStats(); return { content: [ { type: 'text', text: JSON.stringify(stats, null, 2), }, ], }; }
  • Schema definition for the 'get_cache_stats' tool, specifying name, description, and empty input schema (no parameters required).
    name: 'get_cache_stats', description: 'Get cache statistics', inputSchema: { type: 'object', properties: {}, }, },
  • src/index.ts:98-157 (registration)
    Registration of available tools including 'get_cache_stats' in the ListToolsRequestSchema handler.
    tools: [ { name: 'store_data', description: 'Store data in the cache with optional TTL', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Unique identifier for the cached data', }, value: { type: 'any', description: 'Data to cache', }, ttl: { type: 'number', description: 'Time-to-live in seconds (optional)', }, }, required: ['key', 'value'], }, }, { name: 'retrieve_data', description: 'Retrieve data from the cache', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Key of the cached data to retrieve', }, }, required: ['key'], }, }, { name: 'clear_cache', description: 'Clear specific or all cache entries', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Specific key to clear (optional - clears all if not provided)', }, }, }, }, { name: 'get_cache_stats', description: 'Get cache statistics', inputSchema: { type: 'object', properties: {}, }, }, ], }));
  • Core implementation of cache statistics retrieval: returns a shallow copy of the internal stats object containing metrics like totalEntries, memoryUsage, hitRate, etc.
    getStats(): CacheStats { return { ...this.stats }; }

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/ibproduct/ib-mcp-cache-server'

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