---
title: "MCP tools"
description: "The tools that x18n mcp and the HTTP MCP endpoint of x18n ui serve."
canonical_url: "https://x18n.dev/references/mcp-tools"
---
# MCP tools

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

<!-- Generated by docs/scripts/generate.ts from the source code. Do not edit. -->

`x18n mcp` (stdio) and `x18n ui` (HTTP at `/__mcp`) serve these tools. [MCP](https://x18n.dev/agents/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. A key whose format gives it a display label has `label`. 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`?     | `integer` | 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 (and its translation `state` and `description` when the file records them), 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_search

Safety: `read`

Find keys by their value, best match first: the key behind a text seen in the app. Searches every locale, ignoring case, and matches fuzzily unless `exact`. Each match has the matched locale and value, and the usages in code with file, line and column.

| Field      | Type      | Description                                                                         |
| ---------- | --------- | ----------------------------------------------------------------------------------- |
| `project`? | `string`  | Project name from `x18n_status`. Required only in a monorepo with several projects. |
| `query`    | `string`  | Text of the message, as seen in the app, in any locale.                             |
| `exact`?   | `boolean` | Only values containing the query. By default a fuzzy match also counts.             |
| `limit`?   | `integer` | Page size. Default 100.                                                             |
| `cursor`?  | `string`  | `nextCursor` of the previous page.                                                  |

## 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`?   | `integer` | 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`?   | `integer`  | 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`?     | `integer`             | Messages per prompt. Default 50.                                                                                                                                                     |
| `cursor`?    | `string`              | `nextCursor` of the previous prompt.                                                                                                                                                 |
| `stale`?     | `boolean`             | Also translate stale translations: those older than their source message.                                                                                                            |
| `check`?     | `boolean \| string[]` | Also translate values that checks report in the target locale, such as copies of the source (`identical-to-source`): `true` for every check, or a list of check ids.                 |
| `related`?   | `boolean \| string[]` | Values of related locales shown next to each message, such as `pt` for `pt-BR`: `true` (default) picks the locales of the same language, a list names them, `false` leaves them out. |

## 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_reviews

Safety: `read`

Review threads: comments, approvals, change requests and suggested values on messages, per key and locale, with each thread's state. Pass `open: true` for unresolved ones only.

| Field      | Type      | Description                                                                         |
| ---------- | --------- | ----------------------------------------------------------------------------------- |
| `project`? | `string`  | Project name from `x18n_status`. Required only in a monorepo with several projects. |
| `key`?     | `string`  | Only reviews of this key.                                                           |
| `locale`?  | `string`  | Only reviews of this locale.                                                        |
| `open`?    | `boolean` | Only unresolved comments, and only threads that have some.                          |

## x18n_review

Safety: `action`

Leave a review on one message for a human: `request-change` with the reason in `text`, or `suggestion` with a better value in `suggestion` (a human applies it), `approve`, or `comment`. Use it when a human should decide, instead of changing values yourself.

| Field         | Type                                                         | Description                                                                                                                                                             |
| ------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project`?    | `string`                                                     | Project name from `x18n_status`. Required only in a monorepo with several projects.                                                                                     |
| `key`         | `string`                                                     | Key of the reviewed message.                                                                                                                                            |
| `locale`      | `string`                                                     | Locale of the reviewed message.                                                                                                                                         |
| `review`      | `'comment' \| 'approve' \| 'request-change' \| 'suggestion'` | `request-change` for a wrong translation (say why in `text`), `suggestion` to propose a value (in `suggestion`), `approve` for a good one, `comment` for anything else. |
| `text`?       | `string`                                                     | The comment: what is wrong, or why.                                                                                                                                     |
| `suggestion`? | `string`                                                     | The proposed value, for `review: "suggestion"`. Keep every placeholder.                                                                                                 |

## 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_delete_unused_keys

Safety: `destructive`

Delete every unused key (the keys `x18n_keys` lists with `unused: true`) in all locales, optionally only those matching `glob` or `namespace`. Keys that a computed key in code may reach (a template literal prefix, or a computed key under a `keyPrefix` or namespace) are left alone and listed in `kept`; `warnings` names computed keys that may reach any key. Code is not changed. Without `confirm` it returns the plan: `deleted` lists each key with its locales and files. 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.      |
| `glob`?      | `string`  | Only unused keys matching this glob: `*` inside a segment, `**` across segments.         |
| `namespace`? | `string`  | Only unused keys of this namespace.                                                      |
| `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. The key names the resource message. The replacement is the code to insert. If you change the key, also update the corresponding message reference in replacement. Preserve other code and the escaping and namespace syntax that the template requires. x18n_extract_apply does not regenerate replacement from the key. Drop items you do not want, then pass the rest 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. |


## Sitemap

See the full [sitemap](https://x18n.dev/sitemap.md) for all pages.
