Skip to main content
Glama

Translation template

translation_template
Read-only

Generate a per-language translation overlay for a Formhaus form definition, listing texts, keys, placeholders, and source hashes so you can translate values and verify the result.

Instructions

Call this when the form needs another language, once per language: it returns the overlay to translate, which simulate_path accepts as overlay to check the result. Returns the translation skeleton of a definition for one language: overlay is nested JSON with the source texts as values, file is the suggested name (signup.ru.json), slots lists every text with its address, translation key, {placeholders} and a source hash. Translate only the values, keep nesting, identifiers and {placeholders}, then save the overlay next to the definition. Store revision and review state separately; the template never marks anything as translated. When the app has its own keys, such as Lokalise keys, put them in "i18n" objects of the definition exactly as given instead. When the definition has errors, returns ok: false and the validation issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
langYesTarget language code, such as "ru" or "pt-BR". It names the suggested file, such as signup.ru.json.
prefixNoPrefix of derived translation keys, such as "signup" for keys like signup.title. Defaults to the form id. Pass false to list only the explicit keys from i18n objects.
definitionYesFormhaus form definition as a JSON object or a JSON string. JSON Schema: https://formhaus.dev/schema/form-definition.json. Top level: id, title, submit { label }, and fields (one step) or steps [{ id, title, fields }]. Field: { key, type, label, validation?, options?, show?, showAny? }. Rules go inside "validation": { required, minLength, maxLength, min, max, pattern, matchField }. Condition: { field, eq | neq | in | notIn | notEmpty | gt | gte | lt | lte } with exactly one operator, on a field of the same or an earlier step. Optional: lang, messages and labels catalogs, and i18n objects that map texts to translation keys.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
fileNoSuggested file name, such as signup.ru.json.
langNo
slotsNo
overlayNoTranslation skeleton with the source texts as values. Replace the values, keep the nesting.
validationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.13.3
    • changedInput schema / properties / lang / description
      Previous value: -"Target language, such as \"ru\" or \"pt-BR\"."New value: +"Target language code, such as \"ru\" or \"pt-BR\". It names the suggested file, such as signup.ru.json."
    • changedInput schema / properties / prefix / description
      Previous value: -"Prefix of derived translation keys. Defaults to the form id; false lists explicit keys only."New value: +"Prefix of derived translation keys, such as \"signup\" for keys like signup.title. Defaults to the form id. Pass false to list only the explicit keys from i18n objects."
    • addedOutput schema / properties / validation / properties / issues / items / properties / fixes
      Added value: +{
      +  "description": "Ready repairs for this issue. Apply one patch to the definition, then validate again.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "patch": {
      +        "description": "RFC 6902 JSON Patch operations (add, replace, remove, move) with JSON pointer paths.",
      +        "items": {
      +          "additionalProperties": {},
      +          "propertyNames": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "safe": {
      +        "description": "true when applying the patch only repairs the issue and changes nothing else. fix_definition applies these.",
      +        "type": "boolean"
      +      },
      +      "title": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "title",
      +      "safe",
      +      "patch"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. First observedv0.13.1

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnlyHint=true, so the description must carry the rest and does: it states the tool never marks anything as translated, that revision/review state lives elsewhere, and that invalid definitions return ok: false with validation issues. It does not, however, cover rate limits, size constraints, or what happens with an unsupported language code.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the trigger condition and return shape, and each sentence carries information. The block runs long as a single unstructured paragraph and mixes in post-call translation instructions, which slightly dilutes the tool-selection signal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only generator with an output schema already present, the description still covers the error contract, the i18n-keys alternative, and what to do with the returned overlay. Nothing an agent needs to select or invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents lang, prefix, and definition in detail (including the prefix=false behavior and the 'i18n' hint). The description adds only the tangential note about Lokalise-style keys, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific operation (produce the translation skeleton/overlay of a definition for one language) and enumerates what comes back: overlay, file, and slots with addresses, keys, placeholders, and source hashes. It is clearly distinguishable from siblings such as validate_definition, fix_definition, and simulate_path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says when to call it ('when the form needs another language, once per language') and names the condition that selects an alternative ('When the app has its own keys, such as Lokalise keys, put them in i18n objects of the definition exactly as given instead'). It also routes the output to simulate_path, covering the downstream step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.