trigger_build
Initiate a new build for a Codemagic CI/CD application by specifying the app ID, workflow, and optional parameters like branch, tag, or environment variables.
Instructions
Trigger a new build for a Codemagic application.
Args: app_id: The Codemagic application ID. workflow_id: The workflow ID to run. branch: Git branch to build (mutually exclusive with tag). tag: Git tag to build (mutually exclusive with branch). environment: Optional environment variables to override, e.g. {"variables": {"KEY": "value"}}. instance_type: Optional machine instance type to use for the build.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| workflow_id | Yes | ||
| branch | No | ||
| tag | No | ||
| environment | No | ||
| instance_type | No |
Implementation Reference
- codemagic_mcp/tools/builds.py:48-74 (handler)The MCP tool definition for `trigger_build`, which parses arguments and calls the CodemagicClient.
async def trigger_build( app_id: str, workflow_id: str, branch: str | None = None, tag: str | None = None, environment: dict[str, Any] | None = None, instance_type: str | None = None, ) -> Any: """Trigger a new build for a Codemagic application. Args: app_id: The Codemagic application ID. workflow_id: The workflow ID to run. branch: Git branch to build (mutually exclusive with tag). tag: Git tag to build (mutually exclusive with branch). environment: Optional environment variables to override, e.g. {"variables": {"KEY": "value"}}. instance_type: Optional machine instance type to use for the build. """ async with CodemagicClient() as client: return await client.trigger_build( app_id=app_id, workflow_id=workflow_id, branch=branch, tag=tag, environment=environment, instance_type=instance_type, ) - codemagic_mcp/client.py:204-225 (handler)The underlying API implementation for `trigger_build` that sends the request to the Codemagic API.
async def trigger_build( self, app_id: str, workflow_id: str, branch: str | None = None, tag: str | None = None, environment: dict[str, Any] | None = None, instance_type: str | None = None, ) -> Any: payload: dict[str, Any] = { "appId": app_id, "workflowId": workflow_id, } if branch is not None: payload["branch"] = branch if tag is not None: payload["tag"] = tag if environment is not None: payload["environment"] = environment if instance_type is not None: payload["instanceType"] = instance_type return await self._post("/builds", json=payload)