Skip to main content
Glama

Find similar functions

find_similar
Read-onlyIdempotent

Find functions that already do what you are about to write, and places this project has built the same thing twice. Pass functions with one entry per new or edited function (name and file when it is already indexed, one plain sentence when it is not) and each entry comes back with the closest functions in other files. Omit functions for a whole-project audit that groups the functions describing the same behaviour. Matching reads how the index describes a function rather than its body, and every row carries the file and line span of the function it names. For one concept rather than a set of functions, use search_by_intent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoAudit only: compare the functions under this repo-relative directory or file prefix, matched on whole segments (`lib` covers `lib/a.ts`, never `library/a.ts`). In a monorepo the service's directory is part of the path.
repoNoYour repo as owner/repo (git remote) or just the repo name. Resolves which Carrick project to query.
limitNoCeiling on groups per page in the audit mode (default 20, max 50). A page is cut to what one response holds, so it can come back shorter; `clusters_note` states what this page holds and `next_offset` continues it.
top_kNoMatches per entry in the targeted mode (default 5).
offsetNoGroups to skip in the audit mode (default 0). Pass the `next_offset` from a previous call to page through.
projectNoCarrick project slug to query. Omit to auto-resolve via `repo`, or omit both when the workspace has one project.
serviceNoLimit the comparison to one service (fuzzy match by service name, repo name, or trailing segment).
functionsNoOne entry per function to check, up to 20 in a call. Omit for a whole-project audit.
min_linesNoShortest function to compare (audit default 3, targeted default 1). One-line and two-line wrappers carry no behaviour to reuse; the response says how many rows this hid.
scan_fromNoAudit only: where the next window starts. An audit larger than one call compares the functions in windows and each answer names its `window`; pass its `next_scan_from` to continue.
include_testsNoInclude test files, which repeat each other by design (default false).
include_callbacksNoInclude the anonymous callbacks the scan indexed, such as a `map_handler` row (default false). They cannot be imported, so a group of them is not a reuse finding.
include_generatedNoInclude generated and bundled files (default false).
similarity_thresholdNoFloor for a match. Defaults to 0.85 between two indexed functions and 0.45 for a `description`, which are different scales: one side is a stored vector and the other a sentence embedded on the spot. The answer carries `vector_basis` for which stored vectors it compared, and its hint says what that basis means for a renamed copy.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / path
      Added value: +{
      +  "description": "Audit only: compare the functions under this repo-relative directory or file prefix, matched on whole segments (`lib` covers `lib/a.ts`, never `library/a.ts`). In a monorepo the service's directory is part of the path.",
      +  "type": "string"
      +}
    • addedInput schema / properties / scan_from
      Added value: +{
      +  "description": "Audit only: where the next window starts. An audit larger than one call compares the functions in windows and each answer names its `window`; pass its `next_scan_from` to continue.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedInput schema / properties / service / description
      Previous value: -"Limit the comparison to one service (fuzzy match by service name, repo name, or trailing segment). Use it when an audit reports more functions than one pass compares."New value: +"Limit the comparison to one service (fuzzy match by service name, repo name, or trailing segment)."
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, non-destructive), so the description's added value is the matching basis ('reads how the index describes a function rather than its body'), pagination continuation (`clusters_note`, `next_offset`, `window`, `next_scan_from`), and that pages can come back shorter. It does not address error behavior, ambiguity handling beyond the schema, or rate limits, so not a full 5.

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?

Front-loaded with purpose and mode selection in the first two sentences, with the sibling pointer last. Dense and mostly waste-free, though the middle sentence packs matching semantics and return-row structure together, making it slightly heavy.

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 14-parameter tool with no output schema, the description covers the two operating modes, pagination tokens, and matching semantics adequately, and the 100% schema coverage carries the parameter detail. It leaves the shape of a returned match group only partly described, which keeps it short of complete.

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 all 14 parameters thoroughly. The description restates the `functions` entry shape and mode defaults (top_k 5, audit 20) but adds little meaning beyond what the parameter descriptions already provide, so the baseline of 3 applies.

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 and resource ('Find functions that already do what you are about to write') and adds the second use case (duplicate detection across the project). It explicitly distinguishes itself from the sibling search_by_intent by scope ('one concept rather than a set of functions').

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 both invocation modes and the condition that selects each: pass `functions` for targeted per-function lookup, omit it for a whole-project audit. It also names the alternative tool (search_by_intent) and the condition under which it is the right one.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.