Skip to main content
Glama
fabkho
by fabkho

Find Duplicate Translation Keys Across Layers

find_duplicate_keys
Read-only

Detect translation keys in both shared and app i18n layers where app values shadow shared ones. Compare locales, report collisions and divergent values so hidden translations can be fixed.

Instructions

Find translation keys defined in BOTH a shared layer and an app layer that consumes it. For example the same key in a monorepo root layer and in app-shop. At runtime the app layer's value shadows the shared one, so a collision with divergent values is the dangerous case: the shared value silently never shows. Compares one reference locale and reports each collision with both values and a divergent flag. Fix by deleting one side, never by moving.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
localeNoLocale code to compare values in (e.g., "de", "en-US"). Defaults to the project default locale.
byValueNoAlso group different keys carrying the same value — e.g. common.actions.save and calendar.views.save both "Speichern". Each group says what to do about it: "reuse" (a shared layer already has it — delete the app copies and repoint the call sites), "promote" (move one to a shared layer) or "consolidate" (duplication inside one layer). Default: false.
outputFileNoAbsolute path to write the full JSON output to. Only a compact summary is returned to the caller, which is what you want for a result too large to read in one piece. Example: ".i18n-reports/duplicate-keys.json"
projectDirNoAbsolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app".
minValueLengthNoShortest value worth grouping when byValue is set. Default: 4 — below that, values like "OK" repeat across unrelated namespaces legitimately.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.0.6
    • changedInput schema / properties / byValue / description
      Previous value: -"When true, also groups different keys carrying the same value — e.g. common.actions.save and calendar.views.save both \"Speichern\". Each group says what to do about it: \"reuse\" (a shared layer already has it — delete the app copies and repoint call sites), \"promote\" (move one to a shared layer with move_translation_key), or \"consolidate\" (duplication inside one layer). Default: false."New value: +"Also group different keys carrying the same value — e.g. common.actions.save and calendar.views.save both \"Speichern\". Each group says what to do about it: \"reuse\" (a shared layer already has it — delete the app copies and repoint the call sites), \"promote\" (move one to a shared layer) or \"consolidate\" (duplication inside one layer). Default: false."
    • changedInput schema / properties / minValueLength / description
      Previous value: -"Shortest value worth grouping when byValue is set. Default: 4 — below it, values like \"OK\" repeat across unrelated namespaces legitimately."New value: +"Shortest value worth grouping when byValue is set. Default: 4 — below that, values like \"OK\" repeat across unrelated namespaces legitimately."
    • changedInput schema / properties / outputFile / description
      Previous value: -"Absolute path to write full JSON output. Returns only a compact summary to the caller — use this for large outputs to avoid flooding the conversation context. Example: \"/tmp/duplicate-keys.json\""New value: +"Absolute path to write the full JSON output to. Only a compact summary is returned to the caller, which is what you want for a result too large to read in one piece. Example: \".i18n-reports/duplicate-keys.json\""
    • changedInput schema / properties / projectDir / description
      Previous value: -"Absolute path to the Nuxt project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: \"/home/user/my-app\"."New value: +"Absolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: \"/home/user/my-app\"."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "collisions": {
      +          "description": "Keys defined in both a shared layer and a layer that consumes it.",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "childLayer": {
      +                "description": "The consuming layer, whose value wins at runtime.",
      +                "type": "string"
      +              },
      +              "childValue": {
      +                "description": "What the child layer holds — this is what renders."
      +              },
      +              "divergent": {
      +                "description": "True when the two values differ, which is the dangerous case: the shared value silently never shows. Fix by deleting one side, never by moving.",
      +                "type": "boolean"
      +              },
      +              "key": {
      +                "description": "The key both layers define.",
      +                "type": "string"
      +              },
      +              "sharedLayer": {
      +                "description": "The layer that is fallen through to.",
      +                "type": "string"
      +              },
      +              "sharedValue": {
      +                "description": "What the shared layer holds."
      +              }
      +            },
      +            "required": [
      +              "key",
      +              "sharedLayer",
      +              "childLayer",
      +              "sharedValue",
      +              "childValue",
      +              "divergent"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "guidance": {
      +          "description": "How to act on the findings, in one paragraph.",
      +          "type": "string"
      +        },
      +        "summary": {
      +          "additionalProperties": false,
      +          "description": "What the scan compared and what it found. This is what comes back when the full result is diverted to a file.",
      +          "properties": {
      +            "divergentCount": {
      +              "description": "Of those, the ones whose values differ.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "locale": {
      +              "description": "Locale the values were compared in.",
      +              "type": "string"
      +            },
      +            "message": {
      +              "description": "One sentence stating what the scan found.",
      +              "type": "string"
      +            },
      +            "pairsChecked": {
      +              "description": "(shared layer, consuming layer) pairs the scan compared. 0 for a single-layer project.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "reusableGroups": {
      +              "description": "Of those, the ones a shared layer already covers. Present only when byValue was passed.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "totalCollisions": {
      +              "description": "Keys defined in both a shared and a consuming layer.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "valueGroups": {
      +              "description": "Groups of keys sharing a value. Present only when byValue was passed.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            }
      +          },
      +          "required": [
      +            "totalCollisions",
      +            "divergentCount",
      +            "pairsChecked",
      +            "locale"
      +          ],
      +          "type": "object"
      +        },
      +        "valueDuplicates": {
      +          "description": "Different keys carrying the same value. Present only when byValue was passed.",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "action": {
      +                "description": "What to do: \"reuse\" a shared layer already has it, \"promote\" move one to a shared layer, \"consolidate\" duplication inside one layer.",
      +                "enum": [
      +                  "reuse",
      +                  "promote",
      +                  "consolidate"
      +                ],
      +                "type": "string"
      +              },
      +              "members": {
      +                "description": "Every key carrying the value, ordered so the shared ones come first.",
      +                "items": {
      +                  "additionalProperties": false,
      +                  "properties": {
      +                    "key": {
      +                      "description": "A key carrying this value.",
      +                      "type": "string"
      +                    },
      +                    "layer": {
      +                      "description": "The layer it lives in.",
      +                      "type": "string"
      +                    },
      +                    "shared": {
      +                      "description": "True when other layers fall through to this one, so the key is already reachable from them.",
      +                      "type": "boolean"
      +                    }
      +                  },
      +                  "required": [
      +                    "key",
      +                    "layer",
      +                    "shared"
      +                  ],
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "normalized": {
      +                "description": "What the members were grouped by — trimmed, case-folded, punctuation-stripped.",
      +                "type": "string"
      +              },
      +              "value": {
      +                "description": "The value as written, taken from the first member.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "value",
      +              "normalized",
      +              "action",
      +              "members"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "collisions",
      +        "guidance",
      +        "summary"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "reportFile": {
      +          "description": "Absolute path the full JSON result was written to. Read the file for the findings; the summary below is all that came back.",
      +          "type": "string"
      +        },
      +        "summary": {
      +          "additionalProperties": false,
      +          "description": "The counts from the full result, so a caller can act on them without reading the file.",
      +          "properties": {
      +            "divergentCount": {
      +              "description": "Of those, the ones whose values differ.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "locale": {
      +              "description": "Locale the values were compared in.",
      +              "type": "string"
      +            },
      +            "message": {
      +              "description": "One sentence stating what the scan found.",
      +              "type": "string"
      +            },
      +            "pairsChecked": {
      +              "description": "(shared layer, consuming layer) pairs the scan compared. 0 for a single-layer project.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "reusableGroups": {
      +              "description": "Of those, the ones a shared layer already covers. Present only when byValue was passed.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "totalCollisions": {
      +              "description": "Keys defined in both a shared and a consuming layer.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            },
      +            "valueGroups": {
      +              "description": "Groups of keys sharing a value. Present only when byValue was passed.",
      +              "maximum": 9007199254740991,
      +              "minimum": -9007199254740991,
      +              "type": "integer"
      +            }
      +          },
      +          "required": [
      +            "totalCollisions",
      +            "divergentCount",
      +            "pairsChecked",
      +            "locale"
      +          ],
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "reportFile",
      +        "summary"
      +      ],
      +      "type": "object"
      +    }
      +  ],
      +  "type": "object"
      +}
  2. Changed2 schema fields changedv1.0.4
    • addedInput schema / properties / byValue
      Added value: +{
      +  "description": "When true, also groups different keys carrying the same value — e.g. common.actions.save and calendar.views.save both \"Speichern\". Each group says what to do about it: \"reuse\" (a shared layer already has it — delete the app copies and repoint call sites), \"promote\" (move one to a shared layer with move_translation_key), or \"consolidate\" (duplication inside one layer). Default: false.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / minValueLength
      Added value: +{
      +  "description": "Shortest value worth grouping when byValue is set. Default: 4 — below it, values like \"OK\" repeat across unrelated namespaces legitimately.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  3. Addedv1.0.3

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the readOnlyHint/openWorldHint annotations, it discloses runtime semantics (the app layer's value shadows the shared one), why a divergent collision is dangerous (the shared value silently never shows), what the output contains (both values plus a divergent flag), and remediation policy ('Fix by deleting one side, never by moving'). That is substantive behavioral context the annotations do not carry.

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?

Five tight sentences, front-loaded with what is found, then the concrete example, then why it is dangerous, what is reported, and how to fix. The example and the shadowing explanation each earn their place; nothing is padding.

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?

With an output schema present, return format need not be explained, and the annotations already cover the safety profile. The description supplies the runtime rationale and the remediation rule an agent needs to interpret and act on results, so nothing material is missing.

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% and the schema already documents locale, byValue (including reuse/promote/consolidate), outputFile, projectDir and minValueLength in detail. The description only adds 'compares one reference locale', which restates the locale field rather than extending it, so the baseline 3 applies.

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?

States a specific verb and resource (find translation keys defined in BOTH a shared layer and an app layer that consumes it) and gives a concrete example (monorepo root layer vs app-shop). This clearly distinguishes it from siblings like find_undefined_keys and find_orphan_keys, which target different defect classes.

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 frames the situation precisely — keys colliding across layers, with divergent values being the dangerous case worth acting on — so an agent knows when the result matters. It does not, however, name or contrast any sibling tool (e.g. find_undefined_keys / find_orphan_keys), so there is clear context but no explicit exclusions or alternatives.

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