get_languages_tool
Extract supported languages from iOS/macOS Xcode String Catalog (.xcstrings) files to manage localization workflows.
Instructions
MCP tool to get supported languages from xcstrings file.
Args:
file_path (str): Path to the .xcstrings file
Returns:
str: JSON string of supported languages or error message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Implementation Reference
- The handler function for 'get_languages_tool'. It validates the input xcstrings file path, retrieves the supported languages using the imported get_supported_languages function, and returns a formatted string with the list of languages or an error message.@mcp.tool() def get_languages_tool(file_path: str) -> str: """ MCP tool to get supported languages from xcstrings file. Args: file_path (str): Path to the .xcstrings file Returns: str: JSON string of supported languages or error message """ try: if not validate_xcstrings_file(file_path): return f"Error: Invalid file path or not an .xcstrings file: {file_path}" languages = get_supported_languages(file_path) return f"Supported languages: {', '.join(languages)}" except Exception as e: return format_error_message(e, "Failed to get supported languages")