Skip to main content
Glama
GalvinGao

SimpleLocalize MCP Server

by GalvinGao

update_translations

Update multiple translations simultaneously in SimpleLocalize to manage localization changes efficiently. Modify up to 100 translation entries with key, language, and text values in one operation.

Instructions

Update translations in bulk with a single request.

This endpoint allows you to update multiple translations at once. You can update up to 100 translations in a single request. Each translation must specify the key, language, and text. Namespace is optional.

Args: translations: List of dictionaries containing translation information with fields: - key (required): Translation key - language (required): Language code - text (required): Translation text (max 65535 chars) - namespace (optional): Namespace for the key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
translationsYes

Implementation Reference

  • main.py:94-144 (handler)
    The core handler function for the 'update_translations' tool. It is decorated with @mcp.tool() for registration. Validates input translations, cleans them, enforces limit of 100, makes a bulk PATCH request to SimpleLocalize API's /api/v2/translations/bulk endpoint, handles failures, and returns status message.
    @mcp.tool()
    async def update_translations(translations: List[dict]) -> str:
        """Update translations in bulk with a single request.
        
        This endpoint allows you to update multiple translations at once. You can update up to 100 translations in a single request.
        Each translation must specify the key, language, and text. Namespace is optional.
        
        Args:
            translations: List of dictionaries containing translation information with fields:
                - key (required): Translation key
                - language (required): Language code
                - text (required): Translation text (max 65535 chars)
                - namespace (optional): Namespace for the key
        """
        # Validate and clean input
        cleaned_translations = []
        for trans in translations:
            if not all(k in trans for k in ["key", "language", "text"]):
                raise ValueError("Each translation must have 'key', 'language', and 'text' fields")
                
            cleaned_trans = {
                "key": trans["key"],
                "language": trans["language"],
                "text": trans["text"]
            }
            
            # Only include namespace if it exists
            if "namespace" in trans:
                cleaned_trans["namespace"] = trans["namespace"]
                
            cleaned_translations.append(cleaned_trans)
    
        if len(cleaned_translations) > 100:
            raise ValueError("Maximum 100 translations allowed per request")
    
        try:
            result = await make_simplelocalize_request(
                "PATCH",
                "/api/v2/translations/bulk",
                {"translations": cleaned_translations}
            )
            
            if "failures" in result.get("data", {}):
                failures = result["data"]["failures"]
                if failures:
                    return f"Some translations failed to update: {failures}"
            
            return f"Successfully updated {len(cleaned_translations)} translations"
        except SimpleLocalizeError as e:
            return str(e)
  • main.py:19-43 (helper)
    Helper utility function called by the update_translations handler (and other tools) to perform authenticated HTTP requests (POST, PATCH, GET) to the SimpleLocalize API with error handling and timeout.
    async def make_simplelocalize_request(method: str, endpoint: str, json_data: dict | None = None) -> dict[str, Any]:
        """Make a request to the SimpleLocalize API with proper error handling."""
        headers = {
            "X-SimpleLocalize-Token": SIMPLELOCALIZE_API_KEY,
            "Content-Type": "application/json"
        }
        
        url = f"{SIMPLELOCALIZE_API_BASE}{endpoint}"
        
        async with httpx.AsyncClient() as client:
            try:
                if method.upper() == "POST":
                    response = await client.post(url, headers=headers, json=json_data, timeout=30.0)
                elif method.upper() == "PATCH":
                    response = await client.patch(url, headers=headers, json=json_data, timeout=30.0)
                elif method.upper() == "GET":
                    response = await client.get(url, headers=headers, timeout=30.0)
                else:
                    raise ValueError(f"Unsupported HTTP method: {method}")
                
                response.raise_for_status()
                return response.json()
            except httpx.HTTPError as e:
                raise SimpleLocalizeError(f"SimpleLocalize API error: {str(e)}")
  • main.py:94-94 (registration)
    The @mcp.tool() decorator registers the update_translations function as an MCP tool.
    @mcp.tool()
  • The docstring provides the input schema description for the tool, detailing the structure of the 'translations' parameter as a list of dicts with required 'key', 'language', 'text' fields and optional 'namespace'.
    """Update translations in bulk with a single request.
    
    This endpoint allows you to update multiple translations at once. You can update up to 100 translations in a single request.
    Each translation must specify the key, language, and text. Namespace is optional.
    
    Args:
        translations: List of dictionaries containing translation information with fields:
            - key (required): Translation key
            - language (required): Language code
            - text (required): Translation text (max 65535 chars)
            - namespace (optional): Namespace for the key
    """
Behavior2/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 discloses some behavioral traits: bulk capability (up to 100 translations), required/optional fields, and a text length limit. However, it lacks critical details like whether this is a destructive overwrite, what permissions are needed, error handling for invalid inputs, or response format. For a mutation tool with zero annotation coverage, this is insufficient.

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?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by elaboration. The 'Args:' section is well-structured but could be more integrated. Minor redundancy exists (e.g., 'single request' repeated), but overall it's efficient with minimal waste.

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 tool's complexity (bulk mutation), no annotations, no output schema, and low schema coverage, the description is partially complete. It covers parameter semantics well but lacks behavioral context (e.g., side effects, auth needs) and output details. For a mutation tool, this leaves gaps that could hinder agent usage.

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?

The input schema has 0% description coverage (only 'translations' as an array of objects), but the description compensates fully. It details the 'translations' parameter's structure: a list of dictionaries with required fields (key, language, text) and an optional field (namespace), including constraints like max 65535 chars for text. This adds significant meaning beyond the bare schema.

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 tool's purpose: 'Update translations in bulk with a single request.' It specifies the verb ('update'), resource ('translations'), and scope ('in bulk'), distinguishing it from sibling tools like 'create_translation_keys' or 'duplicate_translation'. However, it doesn't explicitly differentiate from all siblings (e.g., 'publish_translations' might also involve updates).

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions bulk updates but doesn't specify scenarios where bulk is preferred over individual updates (e.g., via 'duplicate_translation') or when other tools like 'publish_translations' might be more appropriate. No exclusions or prerequisites are stated.

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/GalvinGao/mcp-simplelocalize'

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