Skip to main content
Glama
fabkho
by fabkho

Translate Key

translate_key
DestructiveIdempotent

Add or update a source translation key and translate it into target locales, overwriting stale translations when needed to keep i18n files in sync.

Instructions

Add or update one source translation key and translate it into the target locales. Unlike translate_missing, this can overwrite an existing but stale target translation. Same two modes as translate_missing: provider mode (the server env-configured) translates directly; agent mode returns a fallbackContext — translate it inline and persist via write_translations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesDot-separated key path to translate. Example: "bookingCreator.options.removeSubResource".
layerYesLayer holding the key, from discover (e.g., "root", "app-admin").
dryRunNoReport the source and target locales without writing files or calling the translation backend. Default: false.
overwriteNoOverwrite existing target translations. When false, only missing targets are filled. Default: true.
projectDirNoAbsolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app".
sourceValueNoSource value to write before translating. If omitted, the existing source value is read.
sourceLocaleYesSource locale ref. May be a code ("en-us"), a language ("en-US") or a file ("en-US.json").
targetLocalesNoLocales to translate into. Pass "all", or omit, for every locale except the source.
includePreviewNoInclude the translated values in the result. Default: false, which keeps the response compact.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe key that was translated.
modeYesHow the run was executed: "provider" called the configured LLM, "agent" returned contexts to translate by hand, "dry-run" wrote nothing.
modelNoModel that produced the translations. Absent outside provider mode.
dryRunYesTrue when nothing was written because a preview was asked for.
failedYesLocales the run attempted and lost.
messageNoWhat to do next, when the run needs something from you — in agent mode, that the fallbackContext has to be translated and written back.
previewNoThe translated values. Present only when includePreview was passed.
skippedYesLocales deliberately not translated.
translatedYesLocales whose value was written.
filesWrittenYesNumber of locale files changed on disk. 0 on a dry run.
sourceLocaleYesThe locale the translation was made from.
updatedSourceYesTrue when a sourceValue was written to the source locale before translating.
wouldTranslateNoLocales a dry run would translate. Present only on a dry run.
fallbackContextNoContext to translate inline and persist with write_translations. Present only in agent mode.
placeholderValidationYesPlaceholder comparison of the new values against the source value.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv1.0.6
    • changedInput schema / properties / dryRun / description
      Previous value: -"When true, previews source/target locales without writing files or calling the translation backend."New value: +"Report the source and target locales without writing files or calling the translation backend. Default: false."
    • changedInput schema / properties / includePreview / description
      Previous value: -"When true, include translated values in output. Default false to keep responses compact."New value: +"Include the translated values in the result. Default: false, which keeps the response compact."
    • changedInput schema / properties / layer / description
      Previous value: -"Layer name from discover to update (e.g., \"root\", \"app-admin\")."New value: +"Layer holding the key, from discover (e.g., \"root\", \"app-admin\")."
    • changedInput schema / properties / overwrite / description
      Previous value: -"When true, overwrite existing target translations. When false, only fill missing targets. Default: true."New value: +"Overwrite existing target translations. When false, only missing targets are filled. Default: true."
    • changedInput schema / properties / projectDir / description
      Previous value: -"Absolute path to the Nuxt project root. Defaults to I18N_PROJECT_DIR, then server cwd."New value: +"Absolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: \"/home/user/my-app\"."
    • changedInput schema / properties / sourceLocale / description
      Previous value: -"Source locale ref. May be code (\"en-us\"), language (\"en-US\"), or file (\"en-US.json\")."New value: +"Source locale ref. May be a code (\"en-us\"), a language (\"en-US\") or a file (\"en-US.json\")."
    • changedInput schema / properties / sourceValue / description
      Previous value: -"Optional source value. If provided, source locale is added/updated before translating. If omitted, existing source value is read."New value: +"Source value to write before translating. If omitted, the existing source value is read."
    • changedInput schema / properties / targetLocales / description
      Previous value: -"Target locales to translate into. Use \"all\" or omit for all locales except source."New value: +"Locales to translate into. Pass \"all\", or omit, for every locale except the source."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "dryRun": {
      +      "description": "True when nothing was written because a preview was asked for.",
      +      "type": "boolean"
      +    },
      +    "failed": {
      +      "description": "Locales the run attempted and lost.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "detail": {
      +            "description": "The underlying message, when there is one worth passing on.",
      +            "type": "string"
      +          },
      +          "locale": {
      +            "description": "Locale that could not be translated.",
      +            "type": "string"
      +          },
      +          "reason": {
      +            "anyOf": [
      +              {
      +                "description": "Why the key could not be translated. A closed set — branch on the value.",
      +                "enum": [
      +                  "provider-error",
      +                  "omitted-by-model",
      +                  "placeholder-mismatch",
      +                  "plural-mismatch",
      +                  "write-error",
      +                  "truncated"
      +                ],
      +                "type": "string"
      +              },
      +              {
      +                "const": "read-error",
      +                "type": "string"
      +              }
      +            ],
      +            "description": "Why it failed. \"read-error\" means the locale file could not be read at all."
      +          }
      +        },
      +        "required": [
      +          "locale",
      +          "reason"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "fallbackContext": {
      +      "additionalProperties": {
      +        "description": "The value of that field, as the prompt builder produced it."
      +      },
      +      "description": "Context to translate inline and persist with write_translations. Present only in agent mode.",
      +      "propertyNames": {
      +        "description": "Context field, e.g. \"keysToTranslate\", \"glossary\", \"instructions\".",
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "filesWritten": {
      +      "description": "Number of locale files changed on disk. 0 on a dry run.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "key": {
      +      "description": "The key that was translated.",
      +      "type": "string"
      +    },
      +    "message": {
      +      "description": "What to do next, when the run needs something from you — in agent mode, that the fallbackContext has to be translated and written back.",
      +      "type": "string"
      +    },
      +    "mode": {
      +      "description": "How the run was executed: \"provider\" called the configured LLM, \"agent\" returned contexts to translate by hand, \"dry-run\" wrote nothing.",
      +      "enum": [
      +        "provider",
      +        "agent",
      +        "dry-run"
      +      ],
      +      "type": "string"
      +    },
      +    "model": {
      +      "description": "Model that produced the translations. Absent outside provider mode.",
      +      "type": "string"
      +    },
      +    "placeholderValidation": {
      +      "additionalProperties": false,
      +      "description": "Placeholder comparison of the new values against the source value.",
      +      "properties": {
      +        "errors": {
      +          "description": "One entry per translation that did not match. Empty when ok is true.",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "extra": {
      +                "description": "Placeholders the translation invented and the source does not have.",
      +                "items": {
      +                  "type": "string"
      +                },
      +                "type": "array"
      +              },
      +              "key": {
      +                "description": "Dot-path key of the mismatching translation.",
      +                "type": "string"
      +              },
      +              "kind": {
      +                "description": "What failed: a placeholder set mismatch (the default) or a vue-i18n plural variant-count mismatch.",
      +                "enum": [
      +                  "placeholder",
      +                  "plural-count"
      +                ],
      +                "type": "string"
      +              },
      +              "locale": {
      +                "description": "Locale code the mismatch was found in.",
      +                "type": "string"
      +              },
      +              "missing": {
      +                "description": "Placeholders the source has and the translation dropped.",
      +                "items": {
      +                  "type": "string"
      +                },
      +                "type": "array"
      +              },
      +              "sourceVariants": {
      +                "description": "Plural variants in the source value. Present only for kind \"plural-count\".",
      +                "maximum": 9007199254740991,
      +                "minimum": -9007199254740991,
      +                "type": "integer"
      +              },
      +              "targetVariants": {
      +                "description": "Plural variants in the translated value. Present only for kind \"plural-count\".",
      +                "maximum": 9007199254740991,
      +                "minimum": -9007199254740991,
      +                "type": "integer"
      +              }
      +            },
      +            "required": [
      +              "locale",
      +              "key",
      +              "missing",
      +              "extra"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "ok": {
      +          "description": "True when every checked translation carries the same placeholders as its source.",
      +          "type": "boolean"
      +        },
      +        "placeholders": {
      +          "description": "Placeholder names found in the source values, e.g. [\"{name}\"].",
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "ok",
      +        "placeholders",
      +        "errors"
      +      ],
      +      "type": "object"
      +    },
      +    "preview": {
      +      "additionalProperties": {
      +        "description": "The value written for that locale.",
      +        "type": "string"
      +      },
      +      "description": "The translated values. Present only when includePreview was passed.",
      +      "propertyNames": {
      +        "description": "Locale code.",
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "skipped": {
      +      "description": "Locales deliberately not translated.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "locale": {
      +            "description": "Locale that was left alone.",
      +            "type": "string"
      +          },
      +          "reason": {
      +            "description": "Why the key or locale was deliberately not attempted. A closed set — branch on the value.",
      +            "enum": [
      +              "no-provider",
      +              "already-translated",
      +              "protected-locale"
      +            ],
      +            "type": "string"
      +          },
      +          "stale": {
      +            "description": "Refines \"already-translated\": true when the existing value was written from source text that has changed since. Translation memory only.",
      +            "type": "boolean"
      +          }
      +        },
      +        "required": [
      +          "locale",
      +          "reason"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "sourceLocale": {
      +      "additionalProperties": false,
      +      "description": "The locale the translation was made from.",
      +      "properties": {
      +        "code": {
      +          "description": "Canonical locale code, e.g. \"en-US\". This is the spelling to pass back to another call.",
      +          "type": "string"
      +        },
      +        "file": {
      +          "description": "Locale file name, e.g. \"en-US.json\". Absent for directory-per-locale layouts such as Laravel.",
      +          "type": "string"
      +        },
      +        "language": {
      +          "description": "BCP-47 language tag, e.g. \"en-GB\". Absent when the framework config carries none.",
      +          "type": "string"
      +        },
      +        "name": {
      +          "description": "Human-readable language name, e.g. \"Deutsch\". Absent unless the framework config names one.",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "code"
      +      ],
      +      "type": "object"
      +    },
      +    "translated": {
      +      "description": "Locales whose value was written.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "updatedSource": {
      +      "description": "True when a sourceValue was written to the source locale before translating.",
      +      "type": "boolean"
      +    },
      +    "wouldTranslate": {
      +      "description": "Locales a dry run would translate. Present only on a dry run.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "key",
      +    "sourceLocale",
      +    "updatedSource",
      +    "mode",
      +    "translated",
      +    "skipped",
      +    "failed",
      +    "filesWritten",
      +    "dryRun",
      +    "placeholderValidation"
      +  ],
      +  "type": "object"
      +}
  2. Changed3 schema fields changedv1.0.3
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / dryRun / description
      Previous value: -"When true, previews source/target locales without writing files or calling sampling."New value: +"When true, previews source/target locales without writing files or calling the translation backend."
    • changedInput schema / properties / projectDir / description
      Previous value: -"Absolute path to the Nuxt project root. Defaults to server cwd."New value: +"Absolute path to the Nuxt project root. Defaults to I18N_PROJECT_DIR, then server cwd."
  3. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=true, and openWorldHint=true, so the safety profile is covered. The description still adds non-obvious behavior: the tool may overwrite existing stale translations, and its execution path diverges by mode — provider mode writes directly while agent mode returns a fallbackContext that the caller must translate and persist via write_translations. That dual-mode contract is the kind of context annotations cannot express.

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?

Front-loaded with the core action, then the sibling differentiation, then the mode mechanics. Three dense sentences with no filler, though the mode sentence packs several ideas (two modes, fallbackContext, persistence tool) tightly enough that it reads more like a spec fragment than prose.

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

Completeness4/5

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

An output schema exists, so return values need no explanation, and the description covers the genuinely tricky part — the mode-dependent control flow and required follow-up call. Minor gaps remain, such as the default breadth of targetLocales and any permission prerequisites, but nothing essential for correct invocation 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%, so the schema already documents all nine parameters, including overwrite, dryRun, and targetLocales defaults. The description restates the overwrite semantics and target locales at a high level but adds no syntax, format, or edge-case detail beyond the schema. Baseline 3 applies 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.

Purpose5/5

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

States a specific verb and resource ('Add or update one source translation key') plus the downstream effect ('translate it into the target locales'). It also names the sibling it differs from (translate_missing) and the exact axis of difference (overwriting stale targets), so an agent can separate the two without opening either schema.

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?

Explicitly routes the agent: 'Unlike translate_missing, this can overwrite an existing but stale target translation.' It further distinguishes the two operating modes (provider vs agent) and, for agent mode, names the follow-up tool (write_translations) needed to persist the result. Nothing about when to pick this tool is left to inference.

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