Skip to main content
Glama

find_semantic_duplicates

Identify duplicate functions in your codebase using AST hash matching for exact copies or embedding cosine similarity for conceptual clones.

Instructions

Find duplicate functions. method='ast' (fast, hash-based, catches copy-paste) or 'embedding' (Nomic cosine, catches conceptual clones, tagged sim=min..mean per cluster).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
min_linesNoSkip functions shorter than this (default 2). Applies to method='ast'.
max_groupsNoMax duplicate groups to return (default 10). Raise for full audit.
methodNoast (default, fast, exact) or embedding (slower, catches conceptual clones). Embedding reuses the symbol_vectors index from search_codebase(semantic=True) — first call triggers a ~2min reindex.
min_similarityNoCosine threshold for method='embedding' (default 0.90). Lower = more recall + more noise.
projectNoProject name/path (default: active).
Behavior4/5

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

With no annotations, the description fully discloses behavior: method performance characteristics, embedding triggering a ~2min reindex, parameter dependencies (min_lines applies to ast, min_similarity to embedding). It is honest about limitations and trade-offs.

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?

Two sentences that front-load the purpose and then provide key method distinctions. Every word is informative with no redundancy.

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?

While the description covers core behavior and parameter semantics well, it does not describe the output format (e.g., structure of duplicate groups) or error conditions. Given the absence of an output schema, this omission leaves the agent uncertain about what to expect from the response.

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 has 100% coverage, but the description adds value by cross-referencing parameters to methods (e.g., 'min_lines applies to ast', 'min_similarity for embedding'), explaining the embedding reindex side effect, and clarifying default thresholds (0.90 for min_similarity). This goes beyond the schema's parameter descriptions.

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 'Find duplicate functions' and distinguishes between two methods (AST and embedding), providing a specific verb-resource pair. No sibling tool overlaps with this exact purpose.

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?

The description explains when to use each method (e.g., ast for copy-paste, embedding for conceptual clones) and mentions the embedding method reuses an index from search_codebase. However, it does not explicitly state when not to use the tool or suggest alternatives.

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/Mibayy/token-savior'

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