MCP Tools
remove_orphan_keys
Find orphan keys (not referenced in source code) and remove them from all locale files. Always does a dry run first. Scope-aware like find_orphan_keys: each layer is checked against its consuming apps (summary.scanScope), and keys referenced only from non-consuming apps are reported as misplacedUsages and never removed.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
layer | string | no | Layer name to clean up (e.g., "root", "app-admin"). If omitted, cleans all layers. Call discover to discover available layers. |
locale | string | no | Locale code to read translation keys from for orphan detection (e.g., "en", "en-US"). Defaults to the project default locale. |
scanDirs | string[] | no | Absolute paths to directories to scan for source code usage. Overrides scope-aware scanning: all layers are checked globally against these dirs. Example: "/home/user/my-app/apps/admin". |
excludeDirs | string[] | no | Directory names to skip when scanning source files. Example: "storybook", "tests", "node_modules". |
dryRun | boolean | no | When true (default), only reports what would be removed without deleting anything. Set to false to permanently delete orphan keys. |
projectDir | string | no | Absolute path to the Nuxt project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app". |
outputFile | string | no | Absolute path to write full JSON output. Returns only a compact summary to the caller — use this for large outputs to avoid flooding the conversation context. Example: "/tmp/cleanup-unused.json" |
Paired CLI Command
The same operation runs from a terminal as the-i18n-cli remove-orphans, whose page documents its flags. Both paths call the same @the-i18n-kit/cli functions, so the result is the same.
Every tool is advertised by the-i18n-mcp and listed on the MCP tools overview.