MCP tools
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.
| Field | Type | Description |
|---|---|---|
project? | string | Project 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
glob? | string | Key glob: * inside a segment, ** across segments. |
missing? | string | Only keys missing or empty in this locale. |
unused? | boolean | Only keys without usages in code. |
namespace? | string | |
values? | boolean | Include the value per locale. |
limit? | number | Page size. Default 100. |
cursor? | string | nextCursor 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
key | string | Full 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
key? | string | Only usages of this key. |
path? | string | Only usages in this file (path relative to the project root). |
limit? | number | Page size. Default 100. |
cursor? | string | nextCursor 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project 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? | number | Page size. Default 100. |
cursor? | string | nextCursor 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
locale | string | Target locale code, as listed by x18n_status. |
keys? | string | string[] | |
namespace? | string | |
limit? | number | Messages per prompt. Default 50. |
cursor? | string | nextCursor of the previous prompt. |
stale? | boolean | Also 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
messages | object | { "<locale>": { "<key>": "<value>" } }, the same shape as x18n apply. |
force? | boolean | Write 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
from | string | Key (or parent of keys) to rename. |
to | string | New key. |
usages? | boolean | Also rewrite usages in code. Default true. |
confirm? | boolean | Apply the plan. Without it, the tool only returns the plan. |
answers? | object | Decision 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
key | string | Key (or parent of keys) to delete. |
locales? | string[] | Only in these locales. Default: all. |
confirm? | boolean | Apply the plan. Without it, the tool only returns the plan. |
answers? | object | Decision 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project 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.
| Field | Type | Description |
|---|---|---|
project? | string | Project name from x18n_status. Required only in a monorepo with several projects. |
items | object[] | Items from x18n_extract_plan, keys and replacements edited as needed; drop items to skip them. |