get_base_strings_tool
Extract base language strings from Xcode String Catalog (.xcstrings) files to support iOS/macOS localization workflows and translation processes.
Instructions
MCP tool to get base language strings from xcstrings file.
Args:
file_path (str): Path to the .xcstrings file
Returns:
str: Base language strings or error messageInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Implementation Reference
- The main handler function for the 'get_base_strings_tool' tool. It is decorated with @mcp.tool() for registration and implements the logic to validate the xcstrings file, extract base language strings using get_base_language_strings, and return them as a formatted string or an error message.
def get_base_strings_tool(file_path: str) -> str: """ MCP tool to get base language strings from xcstrings file. Args: file_path (str): Path to the .xcstrings file Returns: str: Base language strings or error message """ try: if not validate_xcstrings_file(file_path): return f"Error: Invalid file path or not an .xcstrings file: {file_path}" keys = get_base_language_strings(file_path) return f"Base language keys ({len(keys)} total):\n" + "\n".join(keys) except Exception as e: return format_error_message(e, "Failed to get base language strings")