delete_translation
Remove a translation unit from your Lara Translate translation memory by providing its ID, source, target, sentence, and translation.
Instructions
Deletes a translation from a translation memory in your Lara Translate account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID or list of IDs where to delete the translation unit from. Format: mem_xyz123 | |
| source | Yes | The source language code of the sentence | |
| target | Yes | The target language code of the translation | |
| sentence | Yes | The source sentence | |
| translation | Yes | The translated sentence | |
| tuid | No | Translation Unit unique identifier | |
| sentence_before | No | The sentence before the source sentence to specify the context of the translation unit | |
| sentence_after | No | The sentence after the source sentence to specify the context of the translation unit |
Implementation Reference
- The main handler function that executes the delete_translation tool logic. Validates input with Zod schema, then calls lara.memories.deleteTranslation with either a simple (without tuid) or contextual (with tuid, sentence_before, sentence_after) variant.
export async function deleteTranslation(args: any, lara: Translator) { const validatedArgs = deleteTranslationSchema.parse(args); const { id, source, target, sentence, translation, tuid, sentence_before, sentence_after, } = validatedArgs; if (!tuid) { return await lara.memories.deleteTranslation( id, source, target, sentence, translation ); } if ( (sentence_before && !sentence_after) || (!sentence_before && sentence_after) ) { throw new InvalidInputError("Please provide both sentence_before and sentence_after"); } return await lara.memories.deleteTranslation( id, source, target, sentence, translation, tuid, sentence_before, sentence_after ); } - Zod schema defining the input validation for delete_translation: id (array of strings), source (string), target (string), sentence (string), translation (string), tuid (optional string), sentence_before (optional string), sentence_after (optional string).
export const deleteTranslationSchema = z.object({ id: z .array(z.string()) .describe( "The ID or list of IDs where to delete the translation unit from. Format: mem_xyz123" ), source: z.string().describe("The source language code of the sentence"), target: z.string().describe("The target language code of the translation"), sentence: z.string().describe("The source sentence"), translation: z.string().describe("The translated sentence"), tuid: z.string().describe("Translation Unit unique identifier").optional(), sentence_before: z .string() .describe( "The sentence before the source sentence to specify the context of the translation unit" ) .optional(), sentence_after: z .string() .describe( "The sentence after the source sentence to specify the context of the translation unit" ) .optional(), }); - src/mcp/tools.ts:48-68 (registration)Registration of the delete_translation handler in the handlers record (line 55) mapping the string 'delete_translation' to the deleteTranslation function.
const handlers: Record<string, Handler> = { detect_language: detectLanguage, translate: translateHandler, create_memory: createMemory, delete_memory: deleteMemory, update_memory: updateMemory, add_translation: addTranslation, delete_translation: deleteTranslation, import_tmx: importTmx, check_import_status: checkImportStatus, get_glossary: getGlossary, create_glossary: createGlossary, update_glossary: updateGlossary, delete_glossary: deleteGlossary, import_glossary_csv: importGlossaryCsv, check_glossary_import_status: checkGlossaryImportStatus, export_glossary: exportGlossary, get_glossary_counts: getGlossaryCounts, add_glossary_entry: addGlossaryEntry, delete_glossary_entry: deleteGlossaryEntry, }; - src/mcp/tools.ts:279-290 (registration)Tool definition including name ('delete_translation'), description, inputSchema (via z.toJSONSchema), and annotations marking it as destructive (destructiveHint: true).
{ name: "delete_translation", description: "Deletes a translation from a translation memory in your Lara Translate account.", inputSchema: z.toJSONSchema(deleteTranslationSchema), annotations: { title: "Delete translation unit from memory", readOnlyHint: false, destructiveHint: true, openWorldHint: false, }, }, - src/mcp/tools.ts:18-21 (registration)Import of the deleteTranslation function and deleteTranslationSchema from the delete_translation module.
import { deleteTranslation, deleteTranslationSchema, } from "./tools/delete_translation.js";