Skip to main content
Glama

find_clones

Rank code clone classes by ROI using metrics like cross-module spread and cohesion. Filter by minimum similarity and copy count to prioritize high-value refactoring candidates.

Instructions

Ranked candidate clone classes (unrefined; exact overlap metrics). Returns classes sorted by ROI (cross-module spread × member count × token length × load-bearing factor × cohesion), with a completeness provenance block. min_similarity (if set) must be in [0.5, 1.0] (default 0.7). A LIMITED query (limit: N) is capped at the refine budget (currently 50) — it returns at most 50 classes, all refined; pass limit: null/omit it to retrieve all classes (only the top 50 refined). completeness.refine_budget_clamped is true when a supplied limit hit that cap.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of clone classes to return, sorted by ROI descending. A supplied limit is capped at the refine budget (currently 50): `limit: N` returns at most 50 classes, all refined. Omit (null) to retrieve all classes (only the top 50 refined, the rest unrefined).
min_copiesNoMinimum number of copies for a class to be returned (defaults to 2).
min_similarityNoMinimum pairwise overlap/max_len similarity. Must be in the range [0.5, 1.0]; defaults to 0.7 (the θ threshold) when omitted. Out-of-range values are rejected.
Behavior5/5

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

With no annotations, the description fully discloses behavior: ranking formula, refinement, limit cap, and completeness provenance. No contradictions or hidden behaviors.

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?

Description is front-loaded with purpose and ranking, then details parameters. It could be slightly more concise, but every sentence adds necessary information. Good structure.

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

Completeness5/5

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

No output schema exists, but the description adequately covers return value structure (ranked classes, completeness provenance) and key behaviors. Comprehensive for a search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds value by explaining the refine budget cap for 'limit', the range for 'min_similarity', and default values. This goes beyond the schema's baseline.

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 tool finds and ranks clone classes by ROI, using exact overlap metrics. It distinguishes from siblings like 'clones_for_symbol' by being a general, ranked clone finder with refinement details.

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 clear guidance on parameter defaults, ranges, and the refine budget cap. However, it does not explicitly compare to sibling tools or state when to use this over alternatives like 'clones_for_symbol'.

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/cq27-dev/rag-rat'

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