Skip to main content
Glama

find_similar

Read-onlyIdempotent

Find code semantically similar to a snippet before writing a function to check if equivalent logic already exists. Use dense search when you have code to compare, not when describing needs in words.

Instructions

Code semantically similar to a snippet you already have, dense search only: use it before writing a function, to check whether something like it exists. search is the one to call when you can describe the need in words instead. Snippets are cut at 2000 chars.

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": {
      "snippet": "<snippet>"
    },
    "name": "find_similar"
  }
}

Input Schema

NameRequiredDescriptionDefault
top_kNoMax results.
sourceNoSource name. Omit when only one source applies.
snippetYesCode block to match; cut at 2000 chars.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.12.0
    • removedInput schema / properties / source / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / source / default
      Removed value: -null
    • addedInput schema / properties / source / type
      Added value: +"string"
  2. Addedv1.9.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is covered. The description adds genuinely new behavioral context: matching is dense/embedding-based only (no keyword matching), and input is truncated at 2000 chars. It does not describe result ordering or what the matches look like, which is the remaining gap.

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?

Three short sentences, each doing distinct work: purpose, when to use, fallback sibling, and a size constraint. The key routing information is front-loaded. Minor deduction for the elliptical opening phrase, which would read better as a full clause.

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?

There is no output schema, so the description carries the burden of explaining what comes back — yet it says nothing about return shape, match scores, or how many/which fields are returned beyond `top_k`. Given a simple three-parameter read-only tool, the definition is workable but leaves an agent guessing about results.

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 `top_k`, `source`, and `snippet` are already documented, and the description's 2000-char truncation note merely restates the schema's own note. It adds no meaning about how `source` scoping or `top_k` affect results beyond what the schema says, so the baseline 3 applies.

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?

The description states a specific resource and matching method: code semantically similar to a supplied snippet via dense search. It explicitly contrasts with the `search` sibling, so an agent can pick between them. The opening is grammatically elliptical (no verb), which slightly blunts the statement of purpose, but the meaning is unambiguous.

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?

It gives a concrete trigger ('use it before writing a function, to check whether something like it exists') and names the alternative with the condition that selects it ('search is the one to call when you can describe the need in words instead'). This is explicit when-to-use and when-to-use-something-else guidance.

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