Find similar functions
find_similarFind 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. Pass audit: true instead, with no functions, for a whole-project audit that groups the functions describing the same behaviour. A call with neither, or with both, is refused. 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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "find_similar"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | 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. | |
| repo | No | Your repo as owner/repo (git remote) or just the repo name. Resolves which Carrick project to query. | |
| audit | No | Run the whole-project audit: groups of functions that describe the same behaviour. Pass it instead of `functions`; one of the two is required. | |
| limit | No | Ceiling 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_k | No | Matches per entry in the targeted mode (default 5). | |
| offset | No | Groups to skip in the audit mode (default 0). Pass the `next_offset` from a previous call to page through. | |
| project | No | Carrick project slug to query. Omit to auto-resolve via `repo`, or omit both when the workspace has one project. | |
| service | No | An audit compares only this service. A targeted call lists this service's functions in `matches` and counts and names the matches in other services in `outside_service` (fuzzy match by service name, repo name, or trailing segment). | |
| functions | No | One entry per function to check, up to 20 in a call. Do not combine with `audit`. | |
| min_lines | No | Shortest 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_from | No | 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. | |
| include_tests | No | Include test files, which repeat each other by design (default false). | |
| include_callbacks | No | Include 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_generated | No | Include generated and bundled files (default false). | |
| similarity_threshold | No | Floor 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. |