Skip to main content
Glama

find_similar_code

Find code elements similar to a specified function or class using vector similarity. Requires a code element ID from previous queries.

Instructions

Find code elements similar to a given function or class by vector similarity. Requires elementId — use the id field returned by graph_query or code_explain (not a symbol name or natural language string). Optionally set threshold (0–1, default 0.7) and limit. Returns similar elements with names and file paths.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementIdYesCode element ID
thresholdNoSimilarity threshold (0-1)
limitNoResult limit
profileNoResponse profilecompact
Behavior3/5

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

No annotations provided, so the description carries full burden. It discloses the vector similarity method and return fields (names, file paths), but lacks information on permissions, side effects, or rate limits. Adequate but not comprehensive.

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

Conciseness5/5

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

Two clear, front-loaded sentences covering purpose, required parameter, optional settings, and return type. No redundant words; every sentence earns its place.

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?

Covers key aspects: what it does, required input, optional parameters, and output description. However, it does not explain the profile parameter or detail the output structure beyond 'names and file paths', leaving some gaps for a 4-parameter tool with no output schema.

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 coverage is 100%. The description adds meaningful context for elementId (source and type) but merely repeats defaults for threshold and limit, and omits the profile parameter entirely. Baseline 3 applies; marginal added value.

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

Purpose5/5

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

The description clearly states the verb 'Find' and the resource 'code elements similar to a given function or class', specifying the method 'by vector similarity'. This distinguishes it from sibling tools like semantic_search (query-based) and find_pattern (pattern matching).

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

Usage Guidelines4/5

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

Provides explicit instructions: requires elementId from graph_query or code_explain, not a symbol name. However, it does not mention when not to use this tool or suggest alternatives among siblings.

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/lexCoder2/lxDIG-MCP'

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