get_memory_health
Check memory system health statistics for AI systems to monitor data storage performance and continuity.
Instructions
Get overall statistics about memory system health
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_memory_health"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/memory-manager.js:414-425 (handler)The getMemoryHealth() method that retrieves memory health statistics from the database view
async getMemoryHealth() { try { const health = await this.db .select() .from(schema.memoryHealth); return health; } catch (error) { console.error('Error getting memory health:', error); throw error; } } - src/tools/memory-tools.js:173-178 (schema)Tool registration schema defining name, description, and input parameters for get_memory_health
name: "get_memory_health", description: "Get overall statistics about memory system health", inputSchema: { type: "object", properties: {} } - src/db/schema.js:297-305 (schema)Database view definition that aggregates memory health statistics by type (total memories, avg importance, avg access count, etc.)
export const memoryHealth = pgView("memory_health", { type: memoryType(), // You can use { mode: "bigint" } if numbers are exceeding js number limitations totalMemories: bigint("total_memories", { mode: "number" }), avgImportance: doublePrecision("avg_importance"), avgAccessCount: numeric("avg_access_count"), // You can use { mode: "bigint" } if numbers are exceeding js number limitations accessedLastDay: bigint("accessed_last_day", { mode: "number" }), avgRelevance: doublePrecision("avg_relevance"), }).as(sql`SELECT type, count(*) AS total_memories, avg(importance) AS avg_importance, avg(access_count) AS avg_access_count, count(*) FILTER (WHERE last_accessed > (CURRENT_TIMESTAMP - '1 day'::interval)) AS accessed_last_day, avg(relevance_score) AS avg_relevance FROM memories GROUP BY type`); - mcp.js:199-205 (registration)MCP server tool listing registration for get_memory_health
name: "get_memory_health", description: "Get overall statistics about memory system health", inputSchema: { type: "object", properties: {} } }, - mcp.js:593-595 (registration)MCP request handler that routes get_memory_health calls to memoryManager.getMemoryHealth()
case "get_memory_health": const health = await memoryManager.getMemoryHealth(); return { content: [{ type: "text", text: JSON.stringify(health, null, 2) }] };