Skip to main content
Glama

add_terms_with_translations

Add multiple translation terms with their corresponding translations in a single operation to POEditor projects, ensuring proper linkage between terms and translations.

Instructions

PREFERRED METHOD: Create multiple new terms and add their translations in one operation. Use this instead of calling add_terms followed by add_translations separately. This ensures terms and translations are properly linked (especially important when using context).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo
languageYes
itemsYes

Implementation Reference

  • The handler function for the 'add_terms_with_translations' tool. It first adds multiple terms to the POEditor project using the poeditor API, then adds translations for those terms in the specified language. It returns a combined result of terms added and translations added.
    async (args) => {
      const id = requireProjectId(args.project_id ?? null);
    
      // Step 1: Add all terms
      const termData = JSON.stringify(args.items.map(item => ({
        term: item.term,
        context: item.context,
        reference: item.reference,
        tags: item.tags
      })));
      const termRes = await poeditor("terms/add", { id: String(id), data: termData });
    
      // Step 2: Add all translations
      const translationPayload = args.items.map(item => ({
        term: item.term,
        context: item.context ?? "",
        translation: item.translation.plural
          ? { plural: item.translation.plural }
          : { content: item.translation.content, fuzzy: item.translation.fuzzy ? 1 : 0 }
      }));
      const translationData = JSON.stringify(translationPayload);
      const translationRes = await poeditor("translations/add", {
        id: String(id),
        language: args.language,
        data: translationData
      });
    
      // Return combined result
      const result = {
        terms_added: termRes.result?.terms ?? termRes.result,
        translations_added: translationRes.result ?? {}
      };
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining the input parameters for the add_terms_with_translations tool: optional project_id, required language code, and an array of items each with term details and translation (supporting singular, fuzzy, and plural forms).
    const AddTermsWithTranslationsInput = z.object({
      project_id: z.number().int().positive().optional(),
      language: z.string().min(2),
      items: z.array(z.object({
        term: z.string().min(1),
        context: z.string().optional(),
        reference: z.string().optional(),
        tags: z.array(z.string()).optional(),
        translation: z.object({
          content: z.string().default(""),
          fuzzy: z.boolean().optional(),
          plural: z.object({
            one: z.string().optional(),
            few: z.string().optional(),
            many: z.string().optional(),
            other: z.string().optional()
          }).partial().optional()
        })
      })).min(1)
    });
  • src/server.ts:318-356 (registration)
    Registration of the 'add_terms_with_translations' tool using server.tool(), providing the tool name, description, input schema, and inline handler function.
    server.tool(
      "add_terms_with_translations",
      "PREFERRED METHOD: Create multiple new terms and add their translations in one operation. Use this instead of calling add_terms followed by add_translations separately. This ensures terms and translations are properly linked (especially important when using context).",
      AddTermsWithTranslationsInput.shape,
      async (args) => {
        const id = requireProjectId(args.project_id ?? null);
    
        // Step 1: Add all terms
        const termData = JSON.stringify(args.items.map(item => ({
          term: item.term,
          context: item.context,
          reference: item.reference,
          tags: item.tags
        })));
        const termRes = await poeditor("terms/add", { id: String(id), data: termData });
    
        // Step 2: Add all translations
        const translationPayload = args.items.map(item => ({
          term: item.term,
          context: item.context ?? "",
          translation: item.translation.plural
            ? { plural: item.translation.plural }
            : { content: item.translation.content, fuzzy: item.translation.fuzzy ? 1 : 0 }
        }));
        const translationData = JSON.stringify(translationPayload);
        const translationRes = await poeditor("translations/add", {
          id: String(id),
          language: args.language,
          data: translationData
        });
    
        // Return combined result
        const result = {
          terms_added: termRes.result?.terms ?? termRes.result,
          translations_added: translationRes.result ?? {}
        };
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions that the tool 'ensures terms and translations are properly linked,' which adds useful behavioral context about atomicity and data integrity. However, it doesn't disclose other important traits like error handling, permissions required, rate limits, or what happens on failure, leaving gaps for a mutation tool.

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 front-loaded with the key purpose and usage guidelines in the first sentence. Every sentence adds value: the first states what it does, the second gives explicit alternatives, and the third provides additional context. There is no wasted text, making it highly efficient and well-structured.

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

Completeness3/5

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

Given the complexity (3 parameters with nested objects, no annotations, and no output schema), the description is incomplete. It excels in purpose and guidelines but lacks parameter explanations and behavioral details like error handling or return values. For a mutation tool with significant parameter complexity, more information is needed to be fully helpful.

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 0%, meaning none of the parameters are documented in the schema. The description does not explain any parameters—it doesn't mention 'project_id', 'language', or the structure of 'items' (including 'term', 'context', 'reference', 'tags', or 'translation' fields). This fails to compensate for the lack of schema documentation, leaving parameters largely unexplained.

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 specific action: 'Create multiple new terms and add their translations in one operation.' It explicitly distinguishes this tool from its siblings by naming 'add_terms' and 'add_translations' as separate tools that should not be used, making the purpose highly specific and differentiated.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'PREFERRED METHOD' indicates it's the recommended approach, and it specifies 'Use this instead of calling add_terms followed by add_translations separately.' It also mentions a specific scenario where it's important: 'especially important when using context,' giving clear context for its use over alternatives.

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/ryan-shaw/poeditor-mcp'

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