Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

get_memory_clusters

Retrieve and organize memory clusters by importance and activity to enable AI systems to access structured memory data for continuity across conversations.

Instructions

Retrieve memory clusters ordered by importance/activity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of clusters to return

Implementation Reference

  • Core handler function in MemoryManager class that queries the database for memory clusters, including aggregated member counts and IDs, ordered by recency and importance.
    async getMemoryClusters(limit = 20) {
      try {
        const clusters = await this.db
          .select({
            id: schema.memoryClusters.id,
            name: schema.memoryClusters.name,
            clusterType: schema.memoryClusters.clusterType,
            description: schema.memoryClusters.description,
            keywords: schema.memoryClusters.keywords,
            importanceScore: schema.memoryClusters.importanceScore,
            activationCount: schema.memoryClusters.activationCount,
            lastActivated: schema.memoryClusters.lastActivated,
            createdAt: schema.memoryClusters.createdAt,
            memoryCount: sql`COALESCE(count(${schema.memoryClusterMembers.memoryId}) FILTER (WHERE ${schema.memoryClusterMembers.memoryId} IS NOT NULL), 0)`.as('memory_count'),
            memoryIds: sql`COALESCE(array_agg(${schema.memoryClusterMembers.memoryId}) FILTER (WHERE ${schema.memoryClusterMembers.memoryId} IS NOT NULL), ARRAY[]::uuid[])`.as('memory_ids')
          })
          .from(schema.memoryClusters)
          .leftJoin(
            schema.memoryClusterMembers,
            eq(schema.memoryClusters.id, schema.memoryClusterMembers.clusterId)
          )
          .groupBy(schema.memoryClusters.id)
          .orderBy(
            desc(schema.memoryClusters.createdAt),
            desc(schema.memoryClusters.importanceScore)
          )
          .limit(limit);
    
        return clusters;
      } catch (error) {
        console.error('Error getting memory clusters:', error);
        throw error;
      }
    }
  • Tool schema definition including name, description, and input schema for the get_memory_clusters tool.
    {
      name: "get_memory_clusters",
      description: "Retrieve memory clusters ordered by importance/activity",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "integer",
            description: "Maximum number of clusters to return",
            default: 20
          }
        }
      }
    },
  • mcp.js:120-133 (registration)
    Tool registration in MCP server's ListToolsRequestHandler, exposing the schema.
    {
      name: "get_memory_clusters",
      description: "Retrieve memory clusters ordered by importance/activity",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "integer",
            description: "Maximum number of clusters to return",
            default: 20
          }
        }
      }
    },
  • mcp.js:565-567 (handler)
    MCP CallToolRequestHandler case that dispatches to MemoryManager.getMemoryClusters and formats the response.
    case "get_memory_clusters":
      const clusters = await memoryManager.getMemoryClusters(args.limit || 20);
      return { content: [{ type: "text", text: JSON.stringify(clusters, null, 2) }] };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions ordering by 'importance/activity', which adds some context beyond a basic retrieval, but fails to address critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, or what the output format looks like. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core action ('retrieve memory clusters') and adds a key detail ('ordered by importance/activity'). There is no wasted text, making it appropriately concise for a simple retrieval tool.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what memory clusters are, how they relate to sibling tools, or what the return values include (e.g., cluster details, ordering criteria). For a tool in a complex memory management context with many alternatives, more contextual information is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for its single parameter 'limit', so the schema fully documents it. The description adds no additional parameter information beyond what the schema provides, such as typical values or constraints on 'importance/activity' ordering. This meets the baseline of 3 when schema coverage is high.

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

Purpose3/5

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

The description states the verb 'retrieve' and resource 'memory clusters', which clarifies the basic action. However, it doesn't specify what memory clusters are or how they differ from related resources like 'memories' or 'working memories' mentioned in sibling tools, leaving the purpose somewhat vague compared to alternatives like get_memory or get_working_memories.

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?

No guidance is provided on when to use this tool versus alternatives such as get_memory, get_working_memories, or find_similar_clusters. The description mentions ordering by 'importance/activity', but this doesn't explicitly indicate when this ordering is preferred over other retrieval methods, offering minimal usage context.

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

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