Skip to main content
Glama

similar

Find the nearest code neighbors of an existing indexed symbol by its stored embedding. Use for deduplication, refactor planning, or spotting parallel implementations.

Instructions

Nearest neighbours of an EXISTING symbol by its stored embedding (HNSW lookup, ~7-15ms). Distinct from find_similar (which embeds a free-text query). Use this when you have a function in hand and want what else in this repo looks like it? — useful for dedup, refactor planning, and finding parallel implementations. Requires vex index --semantic. Supports diff scoping: since (rev), since_branched, changed_only (mutually exclusive) and no_stale_check.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whyNoSurface a JSON trace under `_meta.why`: seed resolution, applied threshold, candidates before/after path filter, filter snapshot.
nameNoDEPRECATED — use `symbol`. Pre-v1.7 alias, still accepted; emits a deprecated_args notice in _meta.
limitNoMax results
sinceNoRestrict results to files changed between `<rev>..HEAD`. Mutually exclusive with `since_branched` and `changed_only`.
symbolYesExact name of an existing indexed symbol to use as the seed — canonical key (v1.7+).
excludeNoBlacklist results by path glob; wins over include (repeatable)
explainNoInclude reasoning per match: identifier-set Jaccard overlap + truncated unified diff between bodies
includeNoWhitelist results by path glob, gitignore syntax (repeatable)
thresholdNoMinimum cosine similarity (0.0..1.0); raise to tighten matches
auto_updateNoAuto-update the index if stale, or bootstrap it if missing, before running (default: true)
filter_pathNoSubstring path filter applied to result paths (single substring; use include/exclude for glob patterns). Legacy alias: `filter`.
async_updateNoWith auto_update, refresh a stale index in the background instead of waiting for it: results come from the index already on disk and _meta.vex.dev/stale says so (default: false)
changed_onlyNoRestrict results to working-tree changes (staged + unstaged + untracked). Mutually exclusive with `since` and `since_branched`.
project_rootNoAbsolute path to the project root (defaults to the MCP working directory)
exclude_testsNoDrop test files from the results (tests/ dirs, *_test.*, test_*.py, *.spec.ts, __tests__/, tests.rs, ...; same set as tests_for). Composes with include/exclude. Path-based only: Rust unit tests inside a `#[cfg(test)] mod tests` block of a non-test file are not excluded.
no_stale_checkNoSkip the staleness check that runs before each call; assumes the index is fresh. Redundant when `auto_update` is true.
since_branchedNoRestrict results to files changed since this branch diverged from `origin/main` (or `main`/`master`). Mutually exclusive with `since` and `changed_only`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.27.3

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does reasonably well: it discloses the lookup mechanism (HNSW), expected latency (~7-15ms), the hard prerequisite (semantic index), and the mutual-exclusivity constraint among since/since_branched/changed_only. It does not describe failure modes when the seed symbol is missing or what staleness handling looks like by default beyond the no_stale_check note.

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?

Dense but front-loaded: purpose, differentiation, use cases, prerequisite, then constraints. Nearly every clause carries information, though the trailing diff-scoping enumeration partly duplicates the schema descriptions.

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

Completeness4/5

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

For a 17-parameter tool with no annotations and no output schema, the description supplies the operationally critical context (mechanism, latency, prerequisite, flag interactions) an agent needs before calling. Output shape is left unaddressed, but no output schema exists to defer to, which is a minor gap.

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%, so the baseline is 3; every parameter is already documented, including the deprecation of `name` and the mutual exclusivity of the diff-scoping flags. The description mostly restates those constraints rather than adding syntax or interaction detail beyond the schema.

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?

States a specific verb+resource ('nearest neighbours of an EXISTING symbol by its stored embedding') and explicitly distinguishes itself from find_similar, which handles free-text queries. The distinction is actionable without opening either schema.

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

Usage Guidelines5/5

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

Names the alternative (find_similar), the condition that selects this tool ('when you have a function in hand'), concrete use cases (dedup, refactor planning, parallel implementations), and the enabling prerequisite ('Requires `vex index --semantic`').

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