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 }, }, }, });

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