Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

get_cluster_insights

Analyze memory cluster data to extract detailed insights and performance metrics for AI system optimization.

Instructions

Get detailed analytics for a memory cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idYesUUID of the cluster

Implementation Reference

  • Core handler function in MemoryManager class that executes the database query to retrieve detailed insights for a specific memory cluster, including stats like total memories, average importance, recent activity, and memory types.
    async getClusterInsights(clusterId) {
      try {
        const insights = await this.db
          .select({
            id: schema.memoryClusters.id,
            name: schema.memoryClusters.name,
            clusterType: schema.memoryClusters.clusterType,
            description: schema.memoryClusters.description,
            importanceScore: schema.memoryClusters.importanceScore,
            totalMemories: sql`COUNT(${schema.memoryClusterMembers.memoryId})`.as('total_memories'),
            avgImportance: sql`AVG(${schema.memories.importance})`.as('avg_importance'),
            lastMemoryAccess: sql`MAX(${schema.memories.lastAccessed})`.as('last_memory_access'),
            recentMemories: sql`COUNT(CASE WHEN ${schema.memories.createdAt} > CURRENT_TIMESTAMP - INTERVAL '7 days' THEN 1 END)`.as('recent_memories'),
            avgMembershipStrength: sql`AVG(${schema.memoryClusterMembers.membershipStrength})`.as('avg_membership_strength'),
            memoryTypes: sql`array_agg(DISTINCT ${schema.memories.type})`.as('memory_types')
          })
          .from(schema.memoryClusters)
          .leftJoin(
            schema.memoryClusterMembers,
            eq(schema.memoryClusters.id, schema.memoryClusterMembers.clusterId)
          )
          .leftJoin(
            schema.memories,
            and(
              eq(schema.memoryClusterMembers.memoryId, schema.memories.id),
              eq(schema.memories.status, 'active')
            )
          )
          .where(eq(schema.memoryClusters.id, clusterId))
          .groupBy(schema.memoryClusters.id)
          .limit(1);
    
        return insights[0] || null;
      } catch (error) {
        console.warn('Cluster insights query failed:', error.message);
        return null;
      }
    }
  • mcp.js:645-647 (registration)
    Dispatch handler in MCP server that maps the tool call to the MemoryManager.getClusterInsights method and formats the response.
    case "get_cluster_insights":
      const clusterInsights = await memoryManager.getClusterInsights(args.cluster_id);
      return { content: [{ type: "text", text: JSON.stringify(clusterInsights, null, 2) }] };
  • Tool registration entry in ListTools handler defining the name, description, and input schema (cluster_id required).
      name: "get_cluster_insights",
      description: "Get detailed analytics for a memory cluster",
      inputSchema: {
        type: "object",
        properties: {
          cluster_id: {
            type: "string",
            description: "UUID of the cluster"
          }
        },
        required: ["cluster_id"]
      }
    },

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

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