Skip to main content
Glama

find_similar_code

Finds semantically similar functions, classes, or methods from a symbol ID to reveal alternative implementations and repeated code patterns across repositories.

Instructions

Vector similarity search for code patterns. Given a symbol ID, finds semantically similar functions, classes, or methods across the codebase. Useful for discovering alternative implementations or repeated patterns.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "symbol_id": "<symbol_id>"
    },
    "name": "find_similar_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
repoNoFilter to a specific repository (as shown in list_repos)
symbol_idYesSymbol identifier (from search_symbols or get_file_outline results)
max_resultsNoMaximum similar symbols to return (default: 10)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.10.2

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden. It does usefully disclose the mechanism — semantic vector search, implying ranked fuzzy results rather than exact matches — but says nothing about result ordering, why fewer results than requested may come back, whether indexing/latency costs apply, or any permission or scope behavior.

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?

Two sentences, front-loaded with the mechanism and then the resource, with no filler. Minor redundancy between 'code patterns' and 'functions, classes, or methods', but nothing that wastes the reader's attention.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

A three-parameter read tool with no output schema and no annotations needs the description to explain return shape and ranking. It explains what kind of results come back only in prose ('semantically similar functions, classes, or methods') and leaves ordering, tie-breaking, and cross-repo behavior unstated.

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 all three parameters are already documented, including the default of 10 and the 1-1000 range. The description only reinforces that symbol_id is a required seed; it adds no meaning about how repo scoping affects similarity quality or whether max_results truncates a ranked list.

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

Purpose4/5

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

States a specific mechanism (vector similarity search) and resource (code symbols: functions, classes, methods) and names the required seed input (symbol ID). It is clear what the tool does, but it never differentiates itself from likely siblings such as find_code, find_text, or related_code, so the agent must infer the distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an implied use case ('discovering alternative implementations or repeated patterns') but no explicit when-to-use versus when-not-to-use rules. There is no mention of when keyword search (find_code/find_text) is preferable to semantic similarity, which is exactly the decision an agent faces here.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.