Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

find_similar_clusters

Identify clusters with similar characteristics to a specified cluster using similarity thresholds to support memory continuity in AI systems.

Instructions

Find clusters similar to a given cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idYesUUID of the reference cluster
thresholdNoMinimum similarity threshold

Implementation Reference

  • Core handler function that executes the tool logic: queries the database for memory clusters similar to the given clusterId using vector embedding cosine similarity (pgvector <=> operator).
    async findSimilarClusters(clusterId, threshold = 0.7) {
      try {
        const embeddingVector = `[${Array(1536).fill(0).join(',')}]`;
        
        const results = await this.db.execute(sql`
          SELECT 
            mc2.*,
            1 - (mc1.centroid_embedding <=> mc2.centroid_embedding) as similarity
          FROM memory_clusters mc1
          CROSS JOIN memory_clusters mc2
          WHERE mc1.id = ${clusterId}
            AND mc2.id != ${clusterId}
            AND 1 - (mc1.centroid_embedding <=> mc2.centroid_embedding) >= ${threshold}
          ORDER BY similarity DESC
        `);
        
        return results.rows || [];
      } catch (error) {
        console.warn('Similar clusters query failed:', error.message);
        return [];
      }
  • mcp.js:387-404 (registration)
    Registration of the tool in the MCP server's tools array, defining name, description, and input schema.
    {
      name: "find_similar_clusters",
      description: "Find clusters similar to a given cluster",
      inputSchema: {
        type: "object",
        properties: {
          cluster_id: {
            type: "string",
            description: "UUID of the reference cluster"
          },
          threshold: {
            type: "number",
            description: "Minimum similarity threshold",
            default: 0.7
          }
        },
        required: ["cluster_id"]
      }
  • mcp.js:649-654 (handler)
    MCP server request handler that dispatches to memoryManager.findSimilarClusters and returns JSON-formatted response.
    case "find_similar_clusters":
      const similarClusters = await memoryManager.findSimilarClusters(
        args.cluster_id,
        args.threshold || 0.7
      );
      return { content: [{ type: "text", text: JSON.stringify(similarClusters, null, 2) }] };
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states the action without detailing traits like read/write nature, permissions, rate limits, or output format. This is inadequate for a tool that likely involves data retrieval or analysis.

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 with no wasted words, making it easy to parse. However, it lacks front-loaded critical information (e.g., distinguishing from siblings), which slightly reduces its effectiveness despite the brevity.

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 complexity implied by sibling tools (e.g., memory and cluster management), no annotations, and no output schema, the description is incomplete. It doesn't explain what 'clusters' are, how similarity is measured, or what the output entails, leaving significant gaps for agent understanding.

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?

Schema description coverage is 100%, with clear documentation for both parameters ('cluster_id' as UUID, 'threshold' as number with default 0.7). The description adds no additional meaning beyond the schema, such as explaining what 'similar' means or how the threshold is applied, so it meets the baseline for high coverage.

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 tool's purpose as 'Find clusters similar to a given cluster', which is clear but vague. It specifies the verb ('Find') and resource ('clusters'), but doesn't distinguish it from sibling tools like 'search_memories_similarity' or 'find_related_memories', leaving ambiguity about what makes this tool unique.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'search_memories_similarity' and 'find_related_memories', it fails to specify contexts, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

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