update_terms
Modify term metadata like display text, context, references, or tags in POEditor translation projects by identifying terms with their current values.
Instructions
Update term metadata such as the display text, context, references, or tags. Identify each term by its current term/context values.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | ||
| items | Yes |
Implementation Reference
- src/server.ts:262-282 (handler)Handler function that executes the update_terms tool logic: maps input items to payload, calls POEditor 'terms/update' API via poeditor helper, and formats response.UpdateTermsInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const payload = args.items.map((item) => { const termData: Record<string, any> = { term: item.term, context: item.context ?? "" }; if (item.new_term) termData.new_term = item.new_term; if (item.new_context) termData.new_context = item.new_context; if (item.reference) termData.reference = item.reference; if (item.comment) termData.comment = item.comment; if (item.tags) termData.tags = item.tags; if (item.untranslatable !== undefined) { termData.untranslatable = item.untranslatable ? 1 : 0; } return termData; }); const data = JSON.stringify(payload); const res = await poeditor("terms/update", { id: String(id), data }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] };
- src/server.ts:115-127 (schema)Zod input schema for update_terms tool defining project_id (optional) and array of items with current term/context and optional updates.const UpdateTermsInput = z.object({ project_id: z.number().int().positive().optional(), items: z.array(z.object({ term: z.string().min(1), context: z.string().optional(), new_term: z.string().optional(), new_context: z.string().optional(), reference: z.string().optional(), comment: z.string().optional(), tags: z.array(z.string()).optional(), untranslatable: z.boolean().optional() })).min(1) });
- src/server.ts:258-283 (registration)Registration of the update_terms tool via server.tool() call, specifying name, description, schema, and inline handler function.server.tool( "update_terms", "Update term metadata such as the display text, context, references, or tags. Identify each term by its current term/context values.", UpdateTermsInput.shape, async (args) => { const id = requireProjectId(args.project_id ?? null); const payload = args.items.map((item) => { const termData: Record<string, any> = { term: item.term, context: item.context ?? "" }; if (item.new_term) termData.new_term = item.new_term; if (item.new_context) termData.new_context = item.new_context; if (item.reference) termData.reference = item.reference; if (item.comment) termData.comment = item.comment; if (item.tags) termData.tags = item.tags; if (item.untranslatable !== undefined) { termData.untranslatable = item.untranslatable ? 1 : 0; } return termData; }); const data = JSON.stringify(payload); const res = await poeditor("terms/update", { id: String(id), data }); return { content: [{ type: "text", text: JSON.stringify(res.result ?? {}, null, 2) }] }; }