get_build
Retrieve build details and status from Codemagic, including step summary counts. Optionally include full step list with IDs for log retrieval.
Instructions
Get details and status of a specific Codemagic build.
Always includes a step summary (total, success, failed, skipped counts). Set include_steps=True to also get the full list of steps with their IDs, which can then be used with get_step_logs.
Args: build_id: The Codemagic build ID. include_steps: If True, include full step list with IDs. Default False.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| build_id | Yes | ||
| include_steps | No |
Implementation Reference
- codemagic_mcp/tools/builds.py:32-45 (handler)MCP tool handler for 'get_build'. Annotated with @mcp.tool(), accepts build_id (str) and include_steps (bool, default False), creates a CodemagicClient and delegates to client.get_build().
@mcp.tool() async def get_build(build_id: str, include_steps: bool = False) -> Any: """Get details and status of a specific Codemagic build. Always includes a step summary (total, success, failed, skipped counts). Set include_steps=True to also get the full list of steps with their IDs, which can then be used with get_step_logs. Args: build_id: The Codemagic build ID. include_steps: If True, include full step list with IDs. Default False. """ async with CodemagicClient() as client: return await client.get_build(build_id, include_steps=include_steps) - codemagic_mcp/tools/builds.py:32-45 (schema)The schema/interface for get_build: accepts build_id: str and include_steps: bool = False, returns Any. Docstring describes behavior and parameters.
@mcp.tool() async def get_build(build_id: str, include_steps: bool = False) -> Any: """Get details and status of a specific Codemagic build. Always includes a step summary (total, success, failed, skipped counts). Set include_steps=True to also get the full list of steps with their IDs, which can then be used with get_step_logs. Args: build_id: The Codemagic build ID. include_steps: If True, include full step list with IDs. Default False. """ async with CodemagicClient() as client: return await client.get_build(build_id, include_steps=include_steps) - codemagic_mcp/client.py:151-205 (helper)Client-side implementation of get_build. Calls GET /builds/{build_id}, parses response to build a structured dict with app info, build details, commit info, pull request info, and step summary (with optional full step list).
async def get_build(self, build_id: str, include_steps: bool = False) -> Any: data = await self._get(f"/builds/{build_id}") app = data.get("application", {}) build = data.get("build", {}) commit = build.get("commit", {}) or {} pr = build.get("pullRequest") actions = build.get("buildActions", []) from collections import Counter status_counts = Counter(a.get("status") for a in actions) steps: Any = { "total": len(actions), "success": status_counts.get("success", 0), "failed": status_counts.get("failed", 0), "skipped": status_counts.get("skipped", 0), } if include_steps: steps["items"] = [ { "id": a.get("_id"), "name": a.get("name"), "status": a.get("status"), } for a in actions ] return { "appName": app.get("appName"), "appId": app.get("_id"), "build": { "_id": build.get("_id"), "index": build.get("index"), "status": build.get("status"), "branch": build.get("branch"), "tag": build.get("tag"), "workflow": build.get("fileWorkflowId") or build.get("workflowId"), "instanceType": build.get("instanceType"), "startedAt": build.get("startedAt"), "finishedAt": build.get("finishedAt"), "startedBy": build.get("startedBy"), "message": build.get("message"), "commit": { "author": commit.get("authorName"), "message": commit.get("commitMessage"), "hash": commit.get("hash"), }, "pullRequest": { "number": pr.get("number"), "sourceBranch": pr.get("sourceBranch"), "destinationBranch": pr.get("destinationBranch"), "url": pr.get("url"), } if pr else None, "steps": steps, }, } - codemagic_mcp/tools/__init__.py:6-12 (registration)Registration chain: register_all_tools() calls builds.register(mcp), which registers the get_build handler (via @mcp.tool() decorator in builds.py).
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)Entry point: register_all_tools(mcp) is called from server.py to register all tools including get_build.
register_all_tools(mcp)