Skip to main content
Glama
translated

Lara Translate MCP Server

by translated

translate

Translate text between languages with language detection, context-aware processing, and translation memory support for accurate multilingual communication.

Instructions

Translate text between languages with support for language detection, context-aware translations and translation memories using Lara Translate.

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.
instructionsNoA list of instructions to adjust the network’s behavior regarding the output (e.g., 'Use a formal tone').
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.

Implementation Reference

  • The primary handler function for the 'translate' tool. It validates the input arguments using the translateSchema, processes context into instructions, and calls the underlying Translator's translate method.
    export async function translateHandler(args: unknown, lara: Translator) { const validatedArgs = translateSchema.parse(args); const { text, source, target, context, instructions, adapt_to } = validatedArgs; let instructionsList = [...(instructions ?? [])]; if (context) { instructionsList.push(makeInstructions(context)); } const result = await lara.translate(text, source ?? null, target, { instructions: instructionsList, adaptTo: adapt_to, }); return result.translation; }
  • Zod schema definitions for the 'translate' tool inputs, including textBlockSchema for individual blocks and translateSchema for the full parameters (text array, source/target languages, context, instructions, etc.).
    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()) .optional() .describe( "A list of instructions to adjust the network’s behavior regarding the output (e.g., 'Use a formal tone')." ), 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." ), });
  • src/mcp/tools.ts:36-45 (registration)
    Registration of the translateHandler in the handlers object, which is used in CallTool to dispatch tool calls by name.
    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:90-95 (registration)
    The 'translate' tool specification in the ListTools function, which defines the tool's name, description, and input schema for MCP tool listing.
    { name: "translate", description: "Translate text between languages with support for language detection, context-aware translations and translation memories using Lara Translate.", inputSchema: z.toJSONSchema(translateSchema), },
  • Top-level MCP server request handler registration for tools, delegating to ListTools and CallTool (which handle 'translate').
    // -- Tools server.setRequestHandler(ListToolsRequestSchema, ListTools); server.setRequestHandler(CallToolRequestSchema, (request) => CallTool(request, lara) );

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