Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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;
      }
    }
  • 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: {}
    }
  • 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) }] };

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/randyandrade/agi-mcp-server'

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