add_webhook
Subscribe to Codemagic build events by adding a webhook with URL and event list to your application.
Instructions
Add a webhook to a Codemagic application.
Args: app_id: The Codemagic application ID. url: The URL to send webhook payloads to. events: List of events to subscribe to (e.g. ["build.finished", "build.started"]).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| url | Yes | ||
| events | Yes |
Implementation Reference
- codemagic_mcp/tools/webhooks.py:20-30 (handler)The MCP tool handler that defines and registers the 'add_webhook' tool via the @mcp.tool() decorator. It accepts app_id, url, and events parameters, creates a CodemagicClient, and delegates to client.add_webhook().
@mcp.tool() async def add_webhook(app_id: str, url: str, events: list[str]) -> Any: """Add a webhook to a Codemagic application. Args: app_id: The Codemagic application ID. url: The URL to send webhook payloads to. events: List of events to subscribe to (e.g. ["build.finished", "build.started"]). """ async with CodemagicClient() as client: return await client.add_webhook(app_id=app_id, url=url, events=events) - codemagic_mcp/client.py:464-468 (helper)The CodemagicClient.add_webhook() method that sends a POST request to /apps/{app_id}/webhooks with the url and events payload. This is the API client helper that performs the actual HTTP call.
async def add_webhook(self, app_id: str, url: str, events: list[str]) -> Any: return await self._post( f"/apps/{app_id}/webhooks", json={"url": url, "events": events}, ) - codemagic_mcp/tools/__init__.py:6-12 (registration)The register_all_tools() function that calls webhooks.register(mcp), which triggers the registration of add_webhook (and other webhook tools) with the MCP server.
def register_all_tools(mcp: FastMCP) -> None: apps.register(mcp) builds.register(mcp) artifacts.register(mcp) caches.register(mcp) variables.register(mcp) webhooks.register(mcp) - codemagic_mcp/server.py:43-43 (registration)The server startup entry point that calls register_all_tools(mcp) to register all tools including add_webhook.
register_all_tools(mcp)