MCP Tools

translate_key

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.

Parameters

ParameterTypeRequiredDescription
layerstringyesLayer holding the key, from discover (e.g., "root", "app-admin").
keystringyesDot-separated key path to translate. Example: "bookingCreator.options.removeSubResource".
sourceLocalestringyesSource locale ref. May be a code ("en-us"), a language ("en-US") or a file ("en-US.json").
sourceValuestringnoSource value to write before translating. If omitted, the existing source value is read.
targetLocales"all" | string[]noLocales to translate into. Pass "all", or omit, for every locale except the source.
overwritebooleannoOverwrite existing target translations. When false, only missing targets are filled. Default: true.
dryRunbooleannoReport the source and target locales without writing files or calling the translation backend. Default: false.
includePreviewbooleannoInclude the translated values in the result. Default: false, which keeps the response compact.
projectDirstringnoAbsolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app".

Result

FieldTypeDescription
keystringThe key that was translated.
sourceLocaleobjectThe locale the translation was made from.
updatedSourcebooleanTrue when a sourceValue was written to the source locale before translating.
mode"provider" | "agent" | "dry-run"How the run was executed: "provider" called the configured LLM, "agent" returned contexts to translate by hand, "dry-run" wrote nothing.
translatedstring[]Locales whose value was written.
wouldTranslatestring[]Locales a dry run would translate. Present only on a dry run.
skippedobject[]Locales deliberately not translated.
failedobject[]Locales the run attempted and lost.
filesWrittenintegerNumber of locale files changed on disk. 0 on a dry run.
dryRunbooleanTrue when nothing was written because a preview was asked for.
modelstringModel that produced the translations. Absent outside provider mode.
placeholderValidationobjectPlaceholder comparison of the new values against the source value.
previewRecord<string, string>The translated values. Present only when includePreview was passed.
fallbackContextRecord<string, unknown>Context to translate inline and persist with write_translations. Present only in agent mode.
messagestringWhat to do next, when the run needs something from you — in agent mode, that the fallbackContext has to be translated and written back.

Behavior Hints

A host reads these to decide whether a call needs your confirmation first.

HintValue
readOnlyHintfalse
destructiveHinttrue
idempotentHinttrue
openWorldHinttrue

Paired CLI Command

The same operation runs from a terminal as the-i18n-cli translate-key, whose page documents its flags.

Copyright © 2026