Skip to main content
Glama
lingvanex-mt

Lingvanex Translate MCP Server

Official
by lingvanex-mt

translate_text

Translate text between languages using source and target language codes to convert content for multilingual communication and understanding.

Instructions

Translate text from one language to another

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceLangYesSource language code
targetLangYesTarget language code
textYesText to translate

Implementation Reference

  • The asynchronous handler function that executes the core logic of the 'translate_text' tool by invoking the translateText utility and formatting the MCP response.
    async({ text, sourceLang, targetLang }) => { const translated = await translateText(text, sourceLang, targetLang) return { content: [{ type: 'text', text: translated }] } },
  • Zod schema defining the input parameters for the 'translate_text' tool: text, sourceLang, and targetLang.
    { text: z.string().describe('Text to translate'), sourceLang: z.string().length(2).describe('Source language code'), targetLang: z.string().length(2).describe('Target language code'), },
  • src/index.ts:22-22 (registration)
    Registers the 'translate_text' tool on the MCP server by calling the toolTranslateText function.
    toolTranslateText(server)
  • Supporting utility function that performs the actual translation via API call, used by the tool handler.
    export async function translateText( text: string, source: string, target: string, ): Promise<string> { const response = await fetch(`${TRANSLATE_API_URL}/translate`, { method: 'POST', headers: { accept: 'application/json', 'Content-Type': 'application/json', Authorization: TRANSLATE_API_KEY, }, body: JSON.stringify( { platform: 'api', data: text, from: source, to: target, }, ), }) if (!response.ok) { throw new Error(`Translation API error: ${response.status} ${response.statusText}`) } const data = await response.json() as { error: boolean, result: string } return data.result }

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/lingvanex-mt/MCP-Lingvanex-Translate'

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