Skip to main content
Glama

get_memory_stats

Retrieve statistics about stored conversation memory to monitor usage and analyze data patterns in architectural decision records.

Instructions

Phase 3: Get statistics about stored conversation memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for the get_memory_stats tool. Calls memoryManager.getStats() and formats statistics about conversation memory storage including sessions, turns, and size.
     * Get Conversation Memory Statistics Tool
     *
     * Provides statistics about stored conversation memory.
     */
    export async function getMemoryStats(
      memoryManager: ConversationMemoryManager
    ): Promise<CallToolResult> {
      try {
        const stats = await memoryManager.getStats();
    
        let output = `# Conversation Memory Statistics\n\n`;
        output += `## Storage Overview\n\n`;
        output += `- **Total Sessions**: ${stats.totalSessions}\n`;
        output += `- **Active Sessions**: ${stats.activeSessions}\n`;
        output += `- **Archived Sessions**: ${stats.archivedSessions}\n`;
        output += `- **Total Turns**: ${stats.totalTurns}\n`;
        output += `- **Expandable Content Items**: ${stats.totalExpandableContent}\n`;
        output += `- **Average Turns per Session**: ${stats.avgTurnsPerSession.toFixed(2)}\n`;
        output += `- **Total Storage Size**: ${(stats.totalStorageBytes / 1024).toFixed(2)} KB\n`;
    
        return {
          content: [
            {
              type: 'text',
              text: output,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Failed to get memory stats: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool metadata and input schema definition in the central TOOL_CATALOG registry, including description, category, complexity, and inputSchema.
    TOOL_CATALOG.set('get_memory_stats', {
      name: 'get_memory_stats',
      shortDescription: 'Get memory statistics',
      fullDescription: 'Gets statistics about memory usage and storage.',
      category: 'memory',
      complexity: 'simple',
      tokenCost: { min: 200, max: 400 },
      hasCEMCPDirective: true, // Phase 4.3: Simple tool - stats retrieval
      relatedTools: ['memory_loading', 'expand_memory'],
      keywords: ['memory', 'stats', 'statistics', 'usage'],
      requiresAI: false,
      inputSchema: {
        type: 'object',
        properties: {
          detailed: { type: 'boolean', default: false },
        },
      },
    });
  • Registration of the get_memory_stats tool in the dynamic tool catalog used for MCP tool discovery and ListTools responses.
    TOOL_CATALOG.set('get_memory_stats', {
      name: 'get_memory_stats',
      shortDescription: 'Get memory statistics',
      fullDescription: 'Gets statistics about memory usage and storage.',
      category: 'memory',
      complexity: 'simple',
      tokenCost: { min: 200, max: 400 },
      hasCEMCPDirective: true, // Phase 4.3: Simple tool - stats retrieval
      relatedTools: ['memory_loading', 'expand_memory'],
      keywords: ['memory', 'stats', 'statistics', 'usage'],
      requiresAI: false,
      inputSchema: {
        type: 'object',
        properties: {
          detailed: { type: 'boolean', default: false },
        },
      },
    });
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. It states the tool retrieves statistics but does not specify what kind of statistics (e.g., counts, sizes, usage patterns), whether it's read-only, if it requires permissions, or any rate limits. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured for quick understanding.

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 tool has no annotations, no output schema, and 0 parameters, the description is minimal. It states what the tool does but lacks details on the statistics returned, behavioral traits, or usage context, making it incomplete for effective agent invocation without additional assumptions.

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 does not add parameter details, which is appropriate, but it could have clarified the absence of parameters. Baseline is 4 for 0 parameters, as it adequately handles the lack of inputs.

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

Purpose4/5

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

The description clearly states the tool's purpose as 'Get statistics about stored conversation memory', specifying the verb 'Get statistics' and the resource 'stored conversation memory'. However, it does not differentiate from sibling tools like 'get_conversation_snapshot' or 'query_conversation_history', which might involve memory-related operations, leaving some ambiguity in sibling context.

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 lacks context on scenarios, prerequisites, or exclusions, such as how it differs from other memory-related tools in the sibling list, leaving the agent without usage direction.

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/tosin2013/mcp-adr-analysis-server'

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