add_variable
Add environment variables to Codemagic applications for configuration management, including secure variables for secrets and tokens.
Instructions
Add an environment variable to a Codemagic application.
Args: app_id: The Codemagic application ID. key: The variable name. value: The variable value. group: The variable group name. secure: Whether the variable should be encrypted (e.g. for secrets/tokens).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| key | Yes | ||
| value | Yes | ||
| group | Yes | ||
| secure | No |
Implementation Reference
- codemagic_mcp/client.py:288-299 (handler)The implementation of add_variable in the CodemagicClient class.
async def add_variable( self, app_id: str, key: str, value: str, group: str, secure: bool = False, ) -> Any: return await self._post( f"/apps/{app_id}/variables", json={"key": key, "value": value, "group": group, "secure": secure}, ) - codemagic_mcp/tools/variables.py:20-44 (handler)The MCP tool wrapper for add_variable, which calls the client method.
@mcp.tool() async def add_variable( app_id: str, key: str, value: str, group: str, secure: bool = False, ) -> Any: """Add an environment variable to a Codemagic application. Args: app_id: The Codemagic application ID. key: The variable name. value: The variable value. group: The variable group name. secure: Whether the variable should be encrypted (e.g. for secrets/tokens). """ async with CodemagicClient() as client: return await client.add_variable( app_id=app_id, key=key, value=value, group=group, secure=secure, )