Skip to main content
Glama

List the clones of one file

get_file_clones
Read-onlyIdempotent

Find duplicate code for a specific file by listing all clones that include it, showing other files with shared code segments.

Instructions

List every clone from the last scan that involves one file, so you know which other files share code with it. Use it before refactoring, splitting or deleting a file, or after editing it (re-scan first with check_current_directory). Returns {file, clones, returned, duplications[]} where each duplication has 'format', 'fileA', 'startA', 'endA', 'fileB', 'startB', 'endB', 'lines', 'tokens' and 'kind', biggest clone first; the requested file may appear as fileA or fileB. A path that was not part of the scan returns clones 0. Read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe file to inspect, either relative to the scan root exactly as paths appear in other tool results (e.g. 'src/cart.js') or absolute
limitNoMaximum number of clones to include in the response. 'clones' always carries the untruncated total, so a small limit still tells you how much was found.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv5.2.0
    • addedInput schema / properties / limit / default
      Added value: +100
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum clones to include in the response (default 100); 'clones' always carries the untruncated total"New value: +"Maximum number of clones to include in the response. 'clones' always carries the untruncated total, so a small limit still tells you how much was found."
    • changedInput schema / properties / path / description
      Previous value: -"File path, relative to the scan root (as shown in other tool results) or absolute"New value: +"The file to inspect, either relative to the scan root exactly as paths appear in other tool results (e.g. 'src/cart.js') or absolute"
    • addedInput schema / properties / path / examples
      Added value: +[
      +  "src/cart.js"
      +]
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint. The description adds valuable behavioral details: clones are from the last scan, results are ordered biggest first, the requested file may appear as fileA or fileB, and a path outside the scan returns clones 0. It also explains that the 'clones' field carries the untruncated total regardless of the limit. This enriches the agent's understanding beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but efficient, with every sentence adding value: purpose, usage, return structure, edge case, and read-only nature. It is front-loaded with the core action and well-structured, making it easy to parse.

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?

The description fully covers the return shape, including the fields in each duplication and the meaning of 'clones' vs 'returned'. It also addresses the edge case for unscanned paths and the prerequisite re-scanning step. For a tool with no output schema, this is comprehensive and sufficient for an agent to call correctly.

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 both parameters (path and limit) with descriptions and examples. The tool description does not add additional parameter semantics beyond what the schema provides, which matches the baseline of 3 for high coverage.

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's function: 'List every clone from the last scan that involves one file'. It uses a specific verb and resource, and clarifies the purpose by explaining it helps identify other files sharing code. It also mentions the use case context, which distinguishes it from siblings like check_duplication by focusing on a single file's clones.

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?

The description provides explicit usage scenarios: 'Use it before refactoring, splitting or deleting a file, or after editing it (re-scan first with check_current_directory)'. It also notes the edge case of a path not in the scan, which helps the agent understand when results may be empty. This is clear guidance on when to use the tool and how to prepare (re-scanning).

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