Skip to main content
Glama
translated

Lara Translate MCP Server

by translated

add_glossary_entry

Add or replace an entry in a Lara Translate glossary. Supports both monodirectional (first term as source) and multidirectional entries.

Instructions

Adds or replaces an entry in a glossary in your Lara Translate account. Supports both monodirectional and multidirectional glossaries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe glossary ID (format: gls_*, e.g., 'gls_xyz123')
termsYesArray of terms with language and value. For monodirectional glossaries, the first term is the source and the rest are targets. For multidirectional glossaries, all terms are treated equally. Use the list_languages tool to get supported language codes.
guidNoOptional entry identifier. Use this for multidirectional glossaries or to update a specific entry.

Implementation Reference

  • The handler function that adds or replaces a glossary entry. Parses input with Zod schema, then calls lara.glossaries.addOrReplaceEntry(id, terms, guid) or lara.glossaries.addOrReplaceEntry(id, terms) depending on whether an optional guid is provided.
    export async function addGlossaryEntry(args: unknown, lara: Translator) {
      const { id, terms, guid } = addGlossaryEntrySchema.parse(args);
    
      if (guid !== undefined) {
        return await lara.glossaries.addOrReplaceEntry(id, terms, guid);
      }
    
      return await lara.glossaries.addOrReplaceEntry(id, terms);
    }
  • Zod schema defining the input validation for add_glossary_entry. Validates id (format gls_*), terms (array of {language, value}), and optional guid.
    export const addGlossaryEntrySchema = z.object({
      id: z.string()
        .min(1)
        .max(255)
        .regex(/^gls_[a-zA-Z0-9_-]+$/, "Invalid glossary ID format")
        .describe("The glossary ID (format: gls_*, e.g., 'gls_xyz123')"),
      terms: z.array(z.object({
        language: z.string().describe("The language code of the term. Use the list_languages tool to get supported languages."),
        value: z.string().describe("The term value in the specified language"),
      })).min(1).describe(
        "Array of terms with language and value. For monodirectional glossaries, the first term is the source and the rest are targets. For multidirectional glossaries, all terms are treated equally. Use the list_languages tool to get supported language codes."
      ),
      guid: z.string().optional().describe(
        "Optional entry identifier. Use this for multidirectional glossaries or to update a specific entry."
      ),
    });
  • Tool definition registration in the toolDefinitions array. Registers the tool name 'add_glossary_entry' with its description, input schema, and annotations (title, readOnlyHint=false, destructiveHint=false).
        name: "add_glossary_entry",
        description:
          "Adds or replaces an entry in a glossary in your Lara Translate account. Supports both monodirectional and multidirectional glossaries.",
        inputSchema: z.toJSONSchema(addGlossaryEntrySchema),
        annotations: {
          title: "Add or replace glossary entry",
          readOnlyHint: false,
          destructiveHint: false,
          openWorldHint: false,
        },
      },
      {
        name: "delete_glossary_entry",
        description:
          "Deletes an entry from a glossary in your Lara Translate account. Use term for monodirectional glossaries or guid for multidirectional glossaries.",
        inputSchema: z.toJSONSchema(deleteGlossaryEntrySchema),
        annotations: {
          title: "Delete glossary entry",
          readOnlyHint: false,
          destructiveHint: true,
          openWorldHint: false,
        },
      },
    ];
    
    async function ListTools() {
      return { tools: toolDefinitions };
    }
  • src/mcp/tools.ts:66-68 (registration)
    Registration of the handler function in the handlers record mapping 'add_glossary_entry' to the imported addGlossaryEntry function.
      add_glossary_entry: addGlossaryEntry,
      delete_glossary_entry: deleteGlossaryEntry,
    };
  • src/mcp/tools.ts:34-34 (registration)
    Import statement importing addGlossaryEntry and addGlossaryEntrySchema from the dedicated module file.
    import { addGlossaryEntry, addGlossaryEntrySchema } from "./tools/add_glossary_entry.js";
Behavior3/5

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

Annotations indicate readOnlyHint=false and destructiveHint=false, which the description supports by stating 'adds or replaces'. However, it does not disclose whether replacement is destructive or idempotent, nor does it mention required permissions or error conditions.

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?

Two concise sentences with no superfluous words. The first sentence states the core function, and the second adds necessary nuance about glossary types. Highly efficient.

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

Completeness4/5

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

The description covers the main functionality and parameter behavior, but does not mention prerequisites (e.g., that the glossary must exist) or return values (though no output schema exists). For a simple add/replace tool, it is largely complete.

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

Parameters5/5

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

Schema coverage is 100%, and the description adds significant meaning beyond the schema by explaining how the 'terms' parameter behaves differently for monodirectional vs multidirectional glossaries. It also notes that 'guid' is for multidirectional or updating specific entries, and references list_languages for supported codes.

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?

The description clearly states the verb 'adds or replaces' and the resource 'glossary entry' in 'Lara Translate account'. It distinguishes between monodirectional and multidirectional glossaries, but does not explicitly differentiate from sibling tools like delete_glossary_entry.

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?

No explicit guidance on when to use this tool versus alternatives such as delete_glossary_entry or update_glossary. The description only implies its use for adding or replacing entries, without comparative context.

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