Skip to main content
Glama
translated

Lara Translate MCP Server

by translated

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
NameRequiredDescriptionDefault
idYesThe ID or list of IDs where to delete the translation unit from. Format: mem_xyz123
sourceYesThe source language code of the sentence
targetYesThe target language code of the translation
sentenceYesThe source sentence
translationYesThe translated sentence
tuidNoTranslation Unit unique identifier
sentence_beforeNoThe sentence before the source sentence to specify the context of the translation unit
sentence_afterNoThe 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,
    };
  • 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),
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/translated/lara-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server