MCP tools

The tools that x18n mcp and the HTTP MCP endpoint of x18n ui serve.

x18n mcp (stdio) and x18n ui (HTTP at /__mcp) serve these tools. MCP explains how to connect an agent.

Each tool takes one object. A ? after a field name marks an optional field. The safety level tells the agent what a call does: read changes nothing, action writes files, destructive can remove data and asks for confirm: true.

x18n_status

Safety: read

Overview of the i18n project: locales with translation coverage, counts of keys, resources and usages, diagnostics by check, and detected presets. Call it first to learn project names, the source locale and locale codes.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.

x18n_keys

Safety: read

List message keys, paged. Filter by missing locale (keys to translate), unused (keys no code uses), namespace or a key glob. Pass values: true to get the value per locale. Continue with cursor: nextCursor.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
glob?stringKey glob: * inside a segment, ** across segments.
missing?stringOnly keys missing or empty in this locale.
unused?booleanOnly keys without usages in code.
namespace?string
values?booleanInclude the value per locale.
limit?numberPage size. Default 100.
cursor?stringnextCursor of the previous page.

x18n_get

Safety: read

One key: its value in every locale with file and line, locales where it is missing, usages in code with a few lines of context, and diagnostics. Check a key with it before creating or renaming one.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
keystringFull key, for example nav.home or common:save.

x18n_usages

Safety: read

Usages in code, paged: of one key (usages with a computed key under a prefix of it are marked possible), of one file (path), or all. Each usage has file, line, column and a code snippet.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
key?stringOnly usages of this key.
path?stringOnly usages in this file (path relative to the project root).
limit?numberPage size. Default 100.
cursor?stringnextCursor of the previous page.

x18n_check

Safety: read

Run the checks (missing translations, placeholder mismatches, invalid syntax, unused and undefined keys, ...) and return diagnostics, paged. After writing messages, call it with only: ["placeholder-mismatch", "invalid-syntax"] and fix what it reports.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
only?string[]Only these check ids, for example placeholder-mismatch, invalid-syntax, missing-translation.
locale?string[]Only diagnostics for these locales.
limit?numberPage size. Default 100.
cursor?stringnextCursor of the previous page.

x18n_translate_prompt

Safety: read

Instructions for translating missing messages into a locale: rules, glossary, style examples and the items with usage context, as markdown. Follow it, then write the results with x18n_set_messages. It says how many items remain and the cursor for the next batch.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
localestringTarget locale code, as listed by x18n_status.
keys?string | string[]
namespace?string
limit?numberMessages per prompt. Default 50.
cursor?stringnextCursor of the previous prompt.
stale?booleanAlso translate stale translations: those older than their source message.

x18n_set_messages

Safety: action

Set many messages at once: messages is { "<locale>": { "<key>": "<value>" } }, the same shape as x18n apply. Files keep their format, key style and order. When a value drops or adds placeholders compared to the source value, nothing is written and problems lists them (applied: false); fix the values, or pass force: true.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
messagesobject{ "<locale>": { "<key>": "<value>" } }, the same shape as x18n apply.
force?booleanWrite values even when their placeholders differ from the source value.

x18n_rename_key

Safety: destructive

Rename a key (or every key under a parent) in all locales, and its usages in code unless usages: false. Without confirm it returns the plan (files to change, decisions, warnings); call again with confirm: true to apply it.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
fromstringKey (or parent of keys) to rename.
tostringNew key.
usages?booleanAlso rewrite usages in code. Default true.
confirm?booleanApply the plan. Without it, the tool only returns the plan.
answers?objectDecision id to option id, for decisions in the plan. Default: each decision's default.

x18n_delete_key

Safety: destructive

Delete a key (or every key under a parent) in all locales, or only in locales. Code is not changed. Without confirm it returns the plan; call again with confirm: true to apply it.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
keystringKey (or parent of keys) to delete.
locales?string[]Only in these locales. Default: all.
confirm?booleanApply the plan. Without it, the tool only returns the plan.
answers?objectDecision id to option id, for decisions in the plan. Default: each decision's default.

x18n_extract_plan

Safety: read

Find hard-coded strings in source files and propose a key, a message and a code replacement for each. Review the items (edit keys, drop items you do not want), then pass them to x18n_extract_apply.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
files?string[]Only these files (globs relative to the project root). Default: every scanned file.

x18n_extract_apply

Safety: action

Apply extraction items from x18n_extract_plan: adds the messages to the source locale and rewrites the code. Fails when a file changed since the plan was made; plan again then.

FieldTypeDescription
project?stringProject name from x18n_status. Required only in a monorepo with several projects.
itemsobject[]Items from x18n_extract_plan, keys and replacements edited as needed; drop items to skip them.