delete_translation
Remove specific translations from your Lara Translate memory by specifying source and target sentences with their language codes.
Instructions
Deletes a translation from a translation memory from your Lara Translate account.
Input Schema
TableJSON 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 validates input using the schema and calls lara.memories.deleteTranslation with appropriate arguments, handling optional TUID and context sentences.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 Error("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 parameters for the delete_translation tool, including ids, languages, sentences, and optional context.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:36-45 (registration)Registers the deleteTranslation function to the 'delete_translation' key in the handlers map for dispatching tool calls.const handlers: Record<string, Handler> = { translate: translateHandler, create_memory: createMemory, delete_memory: deleteMemory, update_memory: updateMemory, add_translation: addTranslation, delete_translation: deleteTranslation, import_tmx: importTmx, check_import_status: checkImportStatus, };
- src/mcp/tools.ts:120-125 (registration)Registers the tool name, description, and input schema in the ListTools response for MCP protocol compliance.{ name: "delete_translation", description: "Deletes a translation from a translation memory from your Lara Translate account.", inputSchema: z.toJSONSchema(deleteTranslationSchema), },