Skip to main content
Glama
translated

Lara Translate MCP Server

by translated

translate

Read-only

Translate text between languages with language detection, context-aware translations, and support for translation memories and glossaries. Use optional instructions for tone or formality adjustments.

Instructions

Translate text between languages using Lara Translate. Supports language detection, context-aware translations, translation memories, and glossaries. The optional 'instructions' parameter accepts short localization directives (e.g., 'Translate formally') — only provide them when the content specifically requires tone, formality, or terminology adjustments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesAn array of text blocks to translate. Each block contains a text string and a boolean indicating whether it should be translated. This allows for selective translation where some text blocks can be preserved in their original form while others are translated.
sourceNoThe source language code (e.g., 'en-EN' for English). If not specified, the system will attempt to detect it automatically. If you have a hint about the source language, you should specify it in the source_hint field.
targetYesThe target language code (e.g., 'it-IT' for Italian). This specifies the language you want the text translated into.
contextNoAdditional context string to improve translation quality (e.g., 'This is a legal document' or 'Im talking with a doctor'). This helps the translation system better understand the domain.
instructionsNoOptional list of short localization directives to adjust translation output. Each instruction MUST be no more than 20 words. These are NOT free-form LLM prompts — they are expert localization directives about formality, tone, or domain-specific terminology. Only provide instructions when the content specifically requires them; omitting instructions for general content preserves higher translation quality. Do NOT combine contradictory instructions (e.g., formal and informal tone together). Examples: 'Translate formally', 'Use a creative and concise tone', 'Make translation gender-neutral', 'Mask any price with the [price] placeholder', 'Use quotation marks (« ») for quotations'.
source_hintNoUsed to guide language detection. Specify this when the source language is uncertain to improve detection accuracy.
adapt_toNoA list of translation memory IDs for adapting the translation.
glossariesNoArray of glossary IDs to apply during translation (max 10). IDs must match format: gls_* (e.g., ['gls_xyz123', 'gls_abc456']). Glossaries enforce specific terminology and terms.
no_traceNoPrivacy flag. If set to true, the request content will not be stored or traced by Lara. Use for sensitive content.
priorityNoTranslation priority. 'normal' for real-time translations, 'background' for batch processing with lower priority.
timeout_in_millisNoCustom timeout for the translation request in milliseconds. Max: 300000ms (5 minutes). Useful for very long texts.
styleNoControls how the translation balances accuracy against natural readability. 'faithful' stays close to the source, 'fluid' prioritizes natural readability, 'creative' allows more freedom in the translation.
reasoningNoEnables Lara Think multi-step linguistic analysis. Can increase processing time up to 10x but may improve translation quality for complex texts.
content_typeNoSpecifies the content type of the text. Autodetected if omitted.

Implementation Reference

  • The translateHandler function is the core handler for the 'translate' tool. It parses arguments using translateSchema, builds options dynamically, calls lara.translate(), and returns result.translation.
    export async function translateHandler(args: unknown, lara: Translator) {
      const validatedArgs = translateSchema.parse(args);
      const {
        text,
        source,
        target,
        context,
        instructions,
        adapt_to,
        glossaries,
        no_trace,
        priority,
        timeout_in_millis,
        style,
        reasoning,
        content_type
      } = validatedArgs;
      let instructionsList = [...(instructions ?? [])];
    
      if (context) {
        instructionsList.push(makeInstructions(context));
      }
    
      // Audit log for privacy-sensitive requests
      if (no_trace) {
        logger.info({
          action: 'translate',
          privacySensitive: true,
          timestamp: new Date().toISOString()
        }, 'Privacy-sensitive translation requested (noTrace=true)');
      }
    
      // Build options object dynamically to avoid passing undefined values
      const options: Record<string, unknown> = {};
    
      if (instructionsList.length > 0) {
        options.instructions = instructionsList;
      }
      if (typeof adapt_to !== "undefined") {
        options.adaptTo = adapt_to;
      }
      if (typeof glossaries !== "undefined") {
        options.glossaries = glossaries;
      }
      if (typeof no_trace !== "undefined") {
        options.noTrace = no_trace;
      }
      if (typeof priority !== "undefined") {
        options.priority = priority;
      }
      if (typeof timeout_in_millis !== "undefined") {
        options.timeoutInMillis = timeout_in_millis;
      }
      if (typeof style !== "undefined") {
        options.style = style;
      }
      if (typeof reasoning !== "undefined") {
        options.reasoning = reasoning;
      }
      if (typeof content_type !== "undefined") {
        options.contentType = content_type;
      }
    
      const result = await lara.translate(text, source ?? null, target, options);
      return result.translation;
    }
  • The translateSchema and textBlockSchema define input validation for the translate tool using zod. Includes fields: text, source, target, context, instructions, source_hint, adapt_to, glossaries, no_trace, priority, timeout_in_millis, style, reasoning, content_type.
    export const textBlockSchema = z.object({
      text: z.string(),
      translatable: z.boolean(),
    });
    
    export const translateSchema = z.object({
      text: z
        .array(textBlockSchema)
        .describe(
          "An array of text blocks to translate. Each block contains a text string and a boolean indicating whether it should be translated. This allows for selective translation where some text blocks can be preserved in their original form while others are translated."
        ),
      source: z
        .string()
        .optional()
        .describe(
          "The source language code (e.g., 'en-EN' for English). If not specified, the system will attempt to detect it automatically. If you have a hint about the source language, you should specify it in the source_hint field."
        ),
      target: z
        .string()
        .describe(
          "The target language code (e.g., 'it-IT' for Italian). This specifies the language you want the text translated into."
        ),
      context: z
        .string()
        .optional()
        .describe(
          "Additional context string to improve translation quality (e.g., 'This is a legal document' or 'Im talking with a doctor'). This helps the translation system better understand the domain."
        ),
      instructions: z
        .array(
          z.string()
            .refine(
              (s) => s.trim().split(/\s+/).length <= MAX_INSTRUCTION_WORDS,
              { message: `Each instruction must be no more than ${MAX_INSTRUCTION_WORDS} words` }
            )
        )
        .optional()
        .describe(
          `Optional list of short localization directives to adjust translation output. ` +
          `Each instruction MUST be no more than ${MAX_INSTRUCTION_WORDS} words. ` +
          `These are NOT free-form LLM prompts — they are expert localization directives about formality, tone, or domain-specific terminology. ` +
          `Only provide instructions when the content specifically requires them; omitting instructions for general content preserves higher translation quality. ` +
          `Do NOT combine contradictory instructions (e.g., formal and informal tone together). ` +
          `Examples: 'Translate formally', 'Use a creative and concise tone', 'Make translation gender-neutral', ` +
          `'Mask any price with the [price] placeholder', 'Use quotation marks (« ») for quotations'.`
        ),
      source_hint: z
        .string()
        .optional()
        .describe(
          "Used to guide language detection. Specify this when the source language is uncertain to improve detection accuracy."
        ),
      adapt_to: z
        .array(z.string())
        .optional()
        .describe(
          "A list of translation memory IDs for adapting the translation."
        ),
      glossaries: z
        .array(
          z.string()
            .min(1)
            .max(255)
            .regex(/^gls_[a-zA-Z0-9_-]+$/, "Invalid glossary ID format")
        )
        .max(10)
        .optional()
        .describe(
          "Array of glossary IDs to apply during translation (max 10). IDs must match format: gls_* (e.g., ['gls_xyz123', 'gls_abc456']). Glossaries enforce specific terminology and terms."
        ),
      no_trace: z
        .boolean()
        .optional()
        .describe(
          "Privacy flag. If set to true, the request content will not be stored or traced by Lara. Use for sensitive content."
        ),
      priority: z
        .enum(["normal", "background"])
        .optional()
        .describe(
          "Translation priority. 'normal' for real-time translations, 'background' for batch processing with lower priority."
        ),
      timeout_in_millis: z
        .number()
        .int()
        .positive()
        .max(300000)
        .optional()
        .describe(
          "Custom timeout for the translation request in milliseconds. Max: 300000ms (5 minutes). Useful for very long texts."
        ),
      style: z
        .enum(["faithful", "fluid", "creative"])
        .optional()
        .describe(
          "Controls how the translation balances accuracy against natural readability. 'faithful' stays close to the source, 'fluid' prioritizes natural readability, 'creative' allows more freedom in the translation."
        ),
      reasoning: z
        .boolean()
        .optional()
        .describe(
          "Enables Lara Think multi-step linguistic analysis. Can increase processing time up to 10x but may improve translation quality for complex texts."
        ),
      content_type: z
        .enum(["text/plain", "text/html", "application/xliff+xml"])
        .optional()
        .describe(
          "Specifies the content type of the text. Autodetected if omitted."
        ),
    });
  • src/mcp/tools.ts:48-68 (registration)
    The 'translate' handler is registered in the handlers record at line 50, mapping the string 'translate' to the translateHandler 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,
    };
  • The tool definition for 'translate' in the toolDefinitions array includes its name, description (mentioning Lara Translate capabilities), inputSchema, annotations with title 'Translate text', and _meta invocation messages.
    {
      name: "translate",
      description:
        "Translate text between languages using Lara Translate. Supports language detection, context-aware translations, translation memories, and glossaries. " +
        "The optional 'instructions' parameter accepts short localization directives (e.g., 'Translate formally') — only provide them when the content specifically requires tone, formality, or terminology adjustments.",
      inputSchema: z.toJSONSchema(translateSchema),
      annotations: {
        title: "Translate text",
        readOnlyHint: true,
        destructiveHint: false,
        openWorldHint: true,
      },
      _meta: invocationMeta("Translating…", "Translation ready"),
    },
  • src/mcp/tools.ts:89-94 (registration)
    The narrate function handles the 'translate' case (line 91) to produce a human-readable summary of the translation result.
    function narrate(name: string, args: any, result: any): string {
      switch (name) {
        case "translate":
          return Array.isArray(result)
            ? `Translated ${result.length} segments${args?.target ? " to " + args.target : ""}`
            : `Translated text${args?.target ? " to " + args.target : ""}`;
Behavior5/5

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

Annotations include readOnlyHint=true, destructiveHint=false, and openWorldHint=true. The description adds behavioral details beyond these: it explains language detection, context-aware translation, use of memories and glossaries, and the privacy flag (no_trace). There is no contradiction with annotations.

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 extremely concise: two sentences that front-load the core purpose and then provide targeted parameter guidance. Every sentence earns its place; no superfluous content.

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

Completeness5/5

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

Given the tool's complexity (14 parameters, multiple features), the description covers all essential aspects: core functionality, key capabilities, and critical parameter caveats. No output schema exists, but that is acceptable; the description is sufficiently complete for agent understanding.

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

Parameters4/5

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

With 100% schema description coverage, the baseline is 3. The description adds value by elaborating on the 'instructions' parameter (e.g., word limit, not LLM prompts, contradictory instructions) and clarifying that 'text' is an array of objects with translatable flags. This exceeds mere schema repetition.

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 'Translate text between languages using Lara Translate' and lists supported features like language detection, context-aware translations, translation memories, and glossaries. This distinctly separates it from sibling tools such as detect_language, add_translation, and other related services.

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

Usage Guidelines4/5

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

The description provides guidance on when to use the 'instructions' parameter ('only provide them when the content specifically requires tone, formality, or terminology adjustments') and implies general usage context. While it does not explicitly state when not to use this tool versus alternatives, the comprehensive feature list helps an agent decide.

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