get_translations
Get translation values by key path or by key prefix, from one layer or from every layer that defines them. Use "*" as the locale to read from all locales. Pass keys for an explicit list, or keyPrefix to read a whole namespace at once — one of the two is required, and a call with neither fails with EARG. With layer, the result is locale → key → value, exactly as it always was — unless limit cut it short, in which case it answers in the { byLayer } shape below, which has room for truncated and nextOffset. Without layer, every non-alias layer is read and the result is { byLayer, layersSearched }: byLayer holds that same shape per layer and names only the layers defining at least one of the keys, which is what answers where a key lives. limit counts one key per layer read, so a prefix read of seven layers is capped across all of them rather than per layer.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
layer | string | no | Layer name from discover (e.g., "root", "app-admin"). Omit to read every layer and get the { byLayer } shape back. |
locale | string | yes | Locale code, locale file name, or "" to read all locales. Examples: "en", "en-US", "en-US.json", "". |
keys | string[] | no | Dot-separated key paths to read. Example: "common.actions.save", "auth.login.title". Either this or keyPrefix is required. |
keyPrefix | string | no | Namespace to read every leaf key under, dots included: "auth" reads auth.login.title and everything else below auth. Either this or keys is required; passing both reads the union. |
compact | boolean | no | When true and locale is "*", returns a summary grouped by key instead of per-locale detail. Default: false. |
limit | integer | no | Maximum number of keys to return. Default: 100 for a tool call, unlimited at a terminal. When the cap applies the result carries truncated: true and nextOffset — call again with offset set to that value for the next page, or narrow the request instead. |
offset | integer | no | Number of keys to skip before returning any. Default: 0. Pass the nextOffset of a truncated result to continue where it stopped. |
projectDir | string | no | Absolute path to the project root. Defaults to I18N_PROJECT_DIR, then server cwd. Example: "/home/user/my-app". |
Result
| Field | Type | Description |
|---|---|---|
byLayer | Record<string, Record<string, Record<string, unknown>>> | One entry per layer that defines at least one of the keys, each exactly what a read of that layer alone returns. |
layersSearched | string[] | Every layer that was read, the ones defining none of the keys included. |
truncated | boolean | True when limit cut the result short. The totals still count everything. |
nextOffset | integer | The offset to pass to continue where this result stopped. Present only when truncated. |
message | string | The step to take next — how to continue a capped read. Present when there is one. |
Behavior Hints
A host reads these to decide whether a call needs your confirmation first.
| Hint | Value |
|---|---|
readOnlyHint | true |
openWorldHint | false |
Paired CLI Command
The same operation runs from a terminal as the-i18n-cli get, whose page documents its flags.