Aller au contenu

create_key

Create a translation key, idempotent on (namespace, name). Returns created=false if the key already exists. When source_value is supplied AND the project has a source language, the value is also written as a source-language translation in the same call. ALWAYS set type to the key's semantic role (button / link / heading / image / icon / input_label / …) - do NOT leave it as the default 'text'; the type drives the key's a11y treatments. See the type field for the full 17-type taxonomy and when to use each.

NomTypeDescription
project_uuidstringoptionnelProject UUID. Required when multiple projects are configured (SONENTA_PROJECTS); defaults to the single configured project otherwise.
namespacestringrequisNamespace slug (LLM-friendly).
namestringrequisDot-notation key name (e.g. hero.title).
source_valuestringoptionnelOptional source-language value to seed.
descriptionstringoptionnel
pluralsbooleanoptionnel
max_lengthintegeroptionnel
typestringoptionnelSemantic key type. Set this at CREATION - do NOT leave everything as 'text'. The type drives which a11y treatments the key offers (and whether it gets cognitive / plain-language scoring), so correct typing is what lets the a11y tooling work. Pick by the string's UI role: - text - body / paragraph copy (offers plain_language, screen_reader) - heading - a title or section heading (plain_language, screen_reader) - label - a standalone short label (plain_language, screen_reader) - caption - image caption / helper / secondary text (plain_language, screen_reader) - button - a button's label (offers aria_label, screen_reader) - link - a hyperlink / anchor label (aria_label, screen_reader) - menu_item - a navigation / menu entry (aria_label, screen_reader) - input_placeholder - a form input placeholder (aria_label) - input_label - a form field's label (aria_label) - tooltip - tooltip text (screen_reader) - badge - a small status / count badge (screen_reader) - error_message - a validation / error message (screen_reader) - toast - a transient toast / snackbar notification (screen_reader) - image - an image; THIS key's value IS the alt text - icon - an icon; THIS key's value IS the accessible name (aria) - meta_title - an SEO page (no a11y treatment) - meta_description - an SEO meta description (no a11y treatment) Default 'text'. Reclassify existing keys later with update_key / update_keys_bulk (type-only, no source_value needed). The current type is returned by list_keys so you can audit and fix mis-typed keys. (text, heading, label, caption, badge, tooltip, error_message, toast, button, link, menu_item, input_placeholder, input_label, image, icon, meta_title, meta_description)
{
"tool": "create_key",
"arguments": {
"namespace": "<namespace>",
"name": "<name>"
}
}