Skip to main content
Glama
translated

Lara Translate MCP Server

by translated

add_translation

Add a translation unit to your translation memory with source and target language, sentence, translation, and optional context.

Instructions

Adds a translation to a translation memory in your Lara Translate account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID or list of IDs where to save the translation unit. Format: mem_xyz123
sourceYesThe source language code of the sentence, it MUST be a language supported by the system, use the list_languages tool to get a list of all the supported languages
targetYesThe target language code of the translation, it MUST be a language supported by the system, use the list_languages tool to get a list of all the supported languages
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 executes the add_translation tool logic. It validates inputs via the schema, then calls lara.memories.addTranslation() with or without optional tuid/context parameters.
    export async function addTranslation(args: unknown, lara: Translator) {
      const validatedArgs = addTranslationSchema.parse(args);
      const {
        id,
        source,
        target,
        sentence,
        translation,
        tuid,
        sentence_before,
        sentence_after,
      } = validatedArgs;
    
      if (!tuid) {
        return await lara.memories.addTranslation(
          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.addTranslation(
        id,
        source,
        target,
        sentence,
        translation,
        tuid,
        sentence_before,
        sentence_after
      );
    }
  • Zod schema defining the input validation for add_translation, including required fields (id, source, target, sentence, translation) and optional fields (tuid, sentence_before, sentence_after).
    export const addTranslationSchema = z.object({
      id: z
        .array(z.string())
        .describe(
          "The ID or list of IDs where to save the translation unit. Format: mem_xyz123"
        ),
      source: z
        .string()
        .describe(
          "The source language code of the sentence, it MUST be a language supported by the system, use the list_languages tool to get a list of all the supported languages"
        ),
      target: z
        .string()
        .describe(
          "The target language code of the translation, it MUST be a language supported by the system, use the list_languages tool to get a list of all the supported languages"
        ),
      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:8-11 (registration)
    Import statement bringing addTranslation handler and schema into the main tools registry.
    import {
      addTranslation,
      addTranslationSchema,
    } from "./tools/add_translation.js";
  • src/mcp/tools.ts:54-54 (registration)
    Handler mapping that registers 'add_translation' tool name to the addTranslation function.
    add_translation: addTranslation,
  • Tool definition with name, description, inputSchema, and annotations (title, readOnlyHint, destructiveHint) for the 'add_translation' tool.
    {
      name: "add_translation",
      description:
        "Adds a translation to a translation memory in your Lara Translate account.",
      inputSchema: z.toJSONSchema(addTranslationSchema),
      annotations: {
        title: "Add translation unit to memory",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false,
      },
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate readOnlyHint=false (write operation) and destructiveHint=false (non-destructive). The description adds minimal context beyond stating the action. It does not disclose side effects, error behavior on duplicate entries, or permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single 13-word sentence that is front-loaded and contains no superfluous information. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 8 parameters (5 required) and no output schema, the description lacks crucial context: it does not state that the memory must exist, what happens on success (e.g., returns something?), or behavior when a translation unit already exists. The schema IDs give format info but the description should mention prerequisites.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with parameter descriptions already provided. The description adds no additional meaning beyond what is in the schema. It implies the use of 'sentence' and 'translation' but does not elaborate on optional parameters or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Adds' and the resource 'translation to a translation memory' within a Lara Translate account. This distinguishes it from siblings like add_glossary_entry (adds to glossary) and delete_translation (removes translations).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool vs alternatives. For example, it does not suggest using translate for one-off translations or clarify that this tool is for storing pairs in an existing memory. No when-not or alternative tools are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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