Skip to main content
Glama

translate

Convert text between languages using language codes to enable multilingual communication and content adaptation.

Instructions

Translate text to another language ($0.001)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
target_langYesTarget language code (e.g. pt, es, fr)
source_langNoauto

Implementation Reference

  • index.js:41-41 (registration)
    Tool registration for 'translate'.
    { name: 'translate', description: 'Translate text to another language', inputSchema: { type: 'object', properties: { text: { type: 'string' }, target_lang: { type: 'string', description: 'Target language code (e.g. pt, es, fr)' }, source_lang: { type: 'string', default: 'auto' } }, required: ['text', 'target_lang'] }, endpoint: '/translate', price: '$0.001' },
  • index.js:94-115 (handler)
    Tool request handler that delegates execution to callTool.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      
      if (!API_KEY) {
        return {
          content: [{ type: 'text', text: 'Error: ITERATOOLS_API_KEY environment variable not set. Get a key at https://iteratools.com' }],
          isError: true,
        };
      }
      
      const tool = TOOLS.find(t => t.name === name);
      if (!tool) {
        return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
      }
      
      try {
        const result = await callTool(tool.endpoint, args);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      } catch (err) {
        return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
      }
    });
  • Helper function for making API calls to execute tools.
    async function callTool(endpoint, params) {
      const fetch = (await import('node-fetch')).default;
      const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method);
      
      const url = isGet 
        ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}`
        : `${BASE_URL}${endpoint}`;
      
      const res = await fetch(url, {
        method: isGet ? 'GET' : 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${API_KEY}`,
        },
        body: isGet ? undefined : JSON.stringify(params),
      });
      
      const text = await res.text();
      let data;
      try { data = JSON.parse(text); } catch { data = { raw: text }; }
      
      if (!res.ok) {
        if (res.status === 402) {
          throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`);
        }
        throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`);
      }
      
      return data;
    }
Behavior3/5

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

With zero annotations provided, the description must carry the full behavioral burden. It successfully discloses cost ($0.001), but omits critical details like return format (translated string vs object), error handling for unsupported languages, text length limits, or rate limiting.

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

Conciseness4/5

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

Extremely brief single sentence with no filler. While efficient in length, it lacks necessary structural elements like return value description or usage constraints that would make it appropriately informative for an agent without being verbose.

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?

Incomplete for a tool with no output schema and no annotations. Missing explanation of return values, supported language code standards (ISO 639-1?), maximum text length limits, and error conditions. The cost mention is the only operational detail provided.

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

Parameters2/5

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

Schema description coverage is only 33% (only `target_lang` documented). The description fails to compensate by not explaining `source_lang` auto-detection behavior, `text` input constraints (max length, encoding), or semantic relationships between parameters.

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

Purpose4/5

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

States a specific verb ('Translate') and resource ('text'), and includes pricing context ($0.001). Lacks explicit differentiation from siblings like `tts` or `audio_transcribe`, though the core action is clear.

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?

Provides no guidance on when to use this versus alternatives (e.g., `image_ocr` for text extraction followed by translation), no prerequisites mentioned, and fails to explain when to manually specify `source_lang` versus relying on the 'auto' default.

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/fredpsantos33/itera-tools-mcp'

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