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 };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get cache statistics' implies a read-only operation, but it doesn't specify what the statistics include, whether they're real-time or aggregated, if there are rate limits, or what permissions might be required. The description lacks details on return format, potential side effects, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise ('Get cache statistics'), which could be efficient if it were more informative. However, it's under-specified rather than appropriately concise—it lacks necessary details about what statistics are retrieved. While it's front-loaded, it doesn't earn its place by adding sufficient value beyond the tool name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that likely returns complex statistical data. It doesn't explain what the cache statistics include, how they're formatted, or any behavioral nuances. For a tool with no structured metadata, the description should provide more context to help an agent understand its functionality and output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter information, which is appropriate here. A baseline of 4 is applied for zero-parameter tools, as the description doesn't need to compensate for any gaps in schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get cache statistics' is a tautology that essentially restates the tool name 'get_cache_stats' without adding meaningful specificity. It doesn't distinguish what kind of statistics are retrieved (e.g., hit rates, memory usage, entry counts) or how they differ from what might be available through sibling tools like retrieve_data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when it's appropriate to get cache statistics (e.g., for monitoring, debugging, or performance analysis) or how it relates to sibling tools like clear_cache, retrieve_data, or store_data. There's no indication of prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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