Skip to main content
Glama
GalvinGao

SimpleLocalize MCP Server

by GalvinGao

create_translation_keys

Generate multiple translation keys simultaneously for a project. Define keys, optional namespaces, and descriptions to streamline localization processes.

Instructions

Create translation keys in bulk for a project.

This endpoint allows you to create multiple translation keys at once. You can create up to 100 translation keys in a single request. Each key must have a 'key' field, and optionally can include 'namespace' and 'description' fields.

Args: keys: List of dictionaries containing key information with fields: - key (required): Translation key (max 500 chars) - namespace (optional): Namespace for the key (max 64 chars) - description (optional): Description for translators (max 500 chars)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keysYes

Implementation Reference

  • main.py:44-94 (handler)
    The handler function for the 'create_translation_keys' tool, decorated with @mcp.tool(). It validates input keys, makes a POST request to SimpleLocalize API to create translation keys in bulk, and returns success or error message.
    @mcp.tool() async def create_translation_keys(keys: List[dict]) -> str: """Create translation keys in bulk for a project. This endpoint allows you to create multiple translation keys at once. You can create up to 100 translation keys in a single request. Each key must have a 'key' field, and optionally can include 'namespace' and 'description' fields. Args: keys: List of dictionaries containing key information with fields: - key (required): Translation key (max 500 chars) - namespace (optional): Namespace for the key (max 128 chars) - description (optional): Description for translators (max 500 chars) """ # Validate and clean input cleaned_keys = [] for key_info in keys: if not key_info.get("key"): raise ValueError("Each key must have a 'key' field") cleaned_key = { "key": key_info["key"] } # Only include optional fields if they exist if "namespace" in key_info: cleaned_key["namespace"] = key_info["namespace"] if "description" in key_info: cleaned_key["description"] = key_info["description"] cleaned_keys.append(cleaned_key) if len(cleaned_keys) > 100: raise ValueError("Maximum 100 keys allowed per request") try: result = await make_simplelocalize_request( "POST", "/api/v1/translation-keys/bulk", {"translationKeys": cleaned_keys} ) if "failures" in result.get("data", {}): failures = result["data"]["failures"] if failures: return f"Some keys failed to create: {failures}" return f"Successfully created {len(cleaned_keys)} translation keys" except SimpleLocalizeError as e: return str(e) @mcp.tool()

Other Tools

Related 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