Skip to main content
Glama

find_duplicates

Identify and locate near-duplicate content within manuscript directories to maintain content uniqueness and avoid repetition.

Instructions

Find near-duplicate content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathNoPath to manuscript directory (defaults to current directory)
scopeNoFile scope pattern
similarity_thresholdNoSimilarity threshold (0-1)
min_lengthNoMinimum content length
limitNoMaximum results

Implementation Reference

  • Tool registration and input schema for 'find_duplicates' in the MCP tool definitions array
    {
      name: "find_duplicates",
      description: "Find near-duplicate content",
      inputSchema: {
        type: "object",
        properties: {
          project_path: { type: "string", description: "Path to manuscript directory (defaults to current directory)" },
          scope: { type: "string", description: "File scope pattern" },
          similarity_threshold: {
            type: "number",
            description: "Similarity threshold (0-1)",
            default: 0.8,
          },
          min_length: { type: "number", description: "Minimum content length", default: 50 },
          limit: { type: "number", description: "Maximum results", default: 30 },
        },
      },
    },
  • Handler function that processes tool arguments, applies pagination limits, and calls the underlying WritersAid service
    private async findDuplicates(args: Record<string, unknown>) {
      const scope = args.scope as string | undefined;
      const similarityThreshold = (args.similarity_threshold as number) || 0.8;
      const minLength = (args.min_length as number) || 50;
      const limit = resolvePaginationLimit("find_duplicates", args.limit as number | undefined);
    
      return this.writersAid.findDuplicates({ scope, similarityThreshold, minLength, limit });
    }
  • Core duplicate finding logic that compares content paragraphs across files using Jaccard similarity
    async findDuplicates(options: {
      scope?: string;
      similarityThreshold?: number;
      minLength?: number;
      limit?: number;
    }): Promise<DuplicateMatch[]> {
      const { similarityThreshold = 0.8, minLength = 50, limit } = options;
    
      const files = await this.storage.getAllFiles();
      const matches: DuplicateMatch[] = [];
    
      for (let i = 0; i < files.length; i++) {
        for (let j = i + 1; j < files.length; j++) {
          const duplicates = this.compareFiles(
            files[i],
            files[j],
            similarityThreshold,
            minLength
          );
          matches.push(...duplicates);
        }
      }
    
      // Sort by similarity (highest first) before pagination
      const sorted = matches.sort((a, b) => b.similarity - a.similarity);
      return paginateResults(sorted, limit);
    }
  • Delegation method in WritersAid that forwards the call to DuplicateFinder instance
    async findDuplicates(options?: {
      scope?: string;
      similarityThreshold?: number;
      minLength?: number;
      limit?: number;
    }) {
      return this.duplicateFinder.findDuplicates(options || {});
    }
  • Dispatch case in handleTool switch statement that routes to the specific handler
    case "find_duplicates":
      return this.findDuplicates(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It implies a read-only operation ('find') but doesn't specify whether it modifies data, requires permissions, has rate limits, or what the output format looks like. For a tool with 5 parameters and no annotations, this leaves significant behavioral gaps.

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 a single, efficient phrase with zero waste. It's appropriately sized and front-loaded, making it easy to scan without unnecessary elaboration.

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

Completeness2/5

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

Given the complexity of a 5-parameter tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'near-duplicate' means in practice, how results are returned, or the tool's role among many siblings, leaving the agent with insufficient context for effective use.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema, such as explaining how 'similarity_threshold' applies to 'near-duplicate' detection. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Find near-duplicate content' states the general purpose but is vague about the specific resource and scope. It mentions 'content' without specifying whether this refers to files, text sections, or other entities, and doesn't distinguish from siblings like 'find_related_sections' or 'search_similar_mistakes' which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'find_related_sections' and 'search_similar_mistakes', the description doesn't clarify the specific context for detecting duplicates, such as for quality control or content management, nor does it mention prerequisites or exclusions.

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/xiaolai/claude-writers-aid-mcp'

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