MCP Tools

write_translations

Write translation key-value pairs to a layer. Keys are inserted in alphabetical order. Mode "upsert" adds new keys and updates existing ones (default, most common). Mode "add" only creates new keys, skipping existing ones. Mode "update" only modifies existing keys, skipping missing ones. Use dryRun to preview without writing.

Parameters

ParameterTypeRequiredDescription
layerstringyesLayer name from discover (e.g., "root", "app-admin").
translationsRecord<string, Record<string, string>>yesMap of dot-path keys to locale-value pairs. IMPORTANT: values must be locale maps, NOT plain strings. Locale refs may be a code ("en-us"), a language ("en-US") or a file ("en-US.json"). Wrong: { "auth.failed": "Login failed" }. Correct: { "auth.failed": { "en-US": "Login failed", "de-DE": "Anmeldung fehlgeschlagen" } }
mode"add" | "update" | "upsert"noWrite mode. "upsert": add-or-update (never fails). "add": only new keys. "update": only existing keys. Default: "upsert".
dryRunbooleannoReturn a preview of what would be written without writing any files. Default: false.
projectDirstringnoAbsolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app".

Result

FieldTypeDescription
dryRunbooleanTrue when nothing was written because a preview was asked for. Absent otherwise.
wouldWriteobject[]The writes a dry run would make. Present only with dryRun.
writtenstring[]Dot-path keys that were written. Absent on a dry run.
skippedstring[]Keys the write mode left alone — existing keys under mode "add", missing ones under mode "update".
filesWrittenintegerNumber of locale files changed on disk. Absent on a dry run.
warningsstring[]Non-fatal problems, e.g. a value written over a nested object. Absent when there are none.
placeholderValidationobjectPlaceholder comparison of the written values against the reference locale. Absent when nothing was comparable.
unresolvedLocalesobject[]Locale refs that matched no known locale; their values were dropped while other locales were still written. Absent when every ref resolved.
ambiguousLocalesobject[]Locale refs that matched several locales, with the one precedence picked. Absent when every ref was unambiguous.
summaryobjectCounts of what the run did. Absent on a dry run.
skippedKeysstring[]The keys behind keysSkipped, when the mode skipped any. Absent when nothing was skipped.
messagestringThe step to take next, as the surface the call ran on phrases it. Present only when there is no summary to carry it.

Behavior Hints

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

HintValue
readOnlyHintfalse
destructiveHinttrue
idempotentHinttrue
openWorldHintfalse

Paired CLI Command

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

Copyright © 2026