Skip to main content
Glama

memory_similar

Find similar projects by comparing analysis IDs to identify related documentation deployments and repository patterns.

Instructions

Find similar projects from memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisIdYesAnalysis ID to find similar projects for
limitNoMaximum number of similar projects

Implementation Reference

  • Main handler function that implements finding similar projects by searching memory for matching language and framework tags, deduplicating, and computing similarity scores.
    export async function getSimilarProjects(
      analysisData: any,
      limit: number = 5,
    ): Promise<any[]> {
      const manager = await initializeMemory();
    
      // Search for projects with similar characteristics
      const similarProjects: any[] = [];
    
      // Search by language
      if (analysisData.language?.primary) {
        const languageMatches = await manager.search(
          { tags: [analysisData.language.primary] },
          { sortBy: "timestamp" },
        );
        similarProjects.push(...languageMatches);
      }
    
      // Search by framework
      if (analysisData.framework?.name) {
        const frameworkMatches = await manager.search(
          { tags: [analysisData.framework.name] },
          { sortBy: "timestamp" },
        );
        similarProjects.push(...frameworkMatches);
      }
    
      // Deduplicate and return top matches
      const unique = Array.from(
        new Map(similarProjects.map((p) => [p.metadata.projectId, p])).values(),
      );
    
      return unique.slice(0, limit).map((project) => ({
        projectId: project.metadata.projectId,
        similarity: calculateSimilarity(analysisData, project.data),
        recommendation: project.metadata.ssg,
        timestamp: project.timestamp,
      }));
    }
  • Defines the input schema and registers the memory_similar tool within the memoryTools array.
    {
      name: "memory_similar",
      description: "Find similar projects from memory",
      inputSchema: {
        type: "object",
        properties: {
          analysisId: {
            type: "string",
            description: "Analysis ID to find similar projects for",
          },
          limit: {
            type: "number",
            description: "Maximum number of similar projects",
            default: 5,
          },
        },
        required: ["analysisId"],
      },
    },
  • Helper function to compute a similarity score between two project analysis objects based on language, framework, size, and documentation type.
    function calculateSimilarity(data1: any, data2: any): number {
      let score = 0;
    
      // Language match
      if (data1.language?.primary === data2.language?.primary) score += 0.3;
    
      // Framework match
      if (data1.framework?.name === data2.framework?.name) score += 0.3;
    
      // Size similarity
      if (Math.abs((data1.stats?.files || 0) - (data2.stats?.files || 0)) < 100)
        score += 0.2;
    
      // Documentation type match
      if (data1.documentation?.type === data2.documentation?.type) score += 0.2;
    
      return Math.min(score, 1.0);
    }
  • Exports the getSimilarProjects handler function for use in tool implementations.
    getSimilarProjects,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'from memory' but doesn't explain what 'memory' refers to (e.g., a database, cache, or knowledge graph), how similarity is computed, potential limitations (e.g., rate limits, data freshness), or what the output looks like. This leaves significant gaps for a tool that likely involves search or retrieval operations.

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. It's front-loaded with the core action ('Find similar projects'), though it could be more structured by including key details. It earns a 4 for being concise but loses a point for potential under-specification given the tool's complexity.

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 no annotations, no output schema, and a tool that likely involves non-trivial similarity computation, the description is incomplete. It lacks details on behavioral traits, output format, error handling, or how it integrates with sibling tools. For a retrieval tool with 2 parameters, this minimal description is inadequate to guide an agent effectively.

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%, so the schema already documents both parameters ('analysisId' and 'limit') with descriptions and defaults. The description adds no additional meaning beyond implying that 'analysisId' is used to find similar projects, which is already inferred from the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Find similar projects from memory' states a clear verb ('Find') and resource ('similar projects'), but it's vague about what constitutes 'similar' and doesn't differentiate from sibling tools like 'memory_contextual_search' or 'memory_enhanced_recommendation'. It provides basic purpose but lacks specificity about the similarity criteria or domain.

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 offers no guidance on when to use this tool versus alternatives. With many sibling tools in the 'memory_' category (e.g., 'memory_contextual_search', 'memory_recall'), there's no indication of context, prerequisites, or exclusions. Usage is implied only by the tool name and description, not explicitly stated.

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/tosin2013/documcp'

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