list_builds
Retrieve and filter Codemagic CI/CD builds by app, branch, or tag to monitor build history and status.
Instructions
List Codemagic builds, optionally filtered by app, branch, and/or tag.
Args: app_id: Optional app ID to filter builds. If omitted, returns builds across all apps. branch: Optional branch name to filter builds (e.g. "main"). tag: Optional tag name to filter builds (e.g. "release_v5.57.2"). limit: Number of builds per page (default 10). page: Page number to retrieve, starting from 1 (default 1).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | No | ||
| branch | No | ||
| tag | No | ||
| limit | No | ||
| page | No |
Implementation Reference
- codemagic_mcp/client.py:103-146 (handler)Implementation of the list_builds method in the CodemagicClient class, which handles the actual API request to retrieve builds.
async def list_builds( self, app_id: str | None = None, branch: str | None = None, tag: str | None = None, limit: int = 10, page: int = 1, ) -> Any: params: dict[str, Any] = {} if app_id is not None: params["appId"] = app_id if branch is not None: params["branch"] = branch if tag is not None: params["tag"] = tag data = await self._get("/builds", params=params) all_builds = data.get("builds", []) total = len(all_builds) start = (page - 1) * limit end = start + limit page_builds = all_builds[start:end] return { "pagination": { "page": page, "limit": limit, "total": total, "totalPages": (total + limit - 1) // limit if total > 0 else 1, }, "builds": [ { "id": b.get("_id"), "status": b.get("status"), "branch": b.get("branch"), "tag": b.get("tag"), "workflowId": b.get("workflowId"), "workflowName": b.get("workflowName"), "appId": b.get("appId"), "createdAt": b.get("createdAt"), "startedAt": b.get("startedAt"), "finishedAt": b.get("finishedAt"), } for b in page_builds ], } - codemagic_mcp/tools/builds.py:9-30 (registration)Registration of the list_builds tool within the MCP server.
def register(mcp: FastMCP) -> None: @mcp.tool() async def list_builds( app_id: str | None = None, branch: str | None = None, tag: str | None = None, limit: int = 10, page: int = 1, ) -> Any: """List Codemagic builds, optionally filtered by app, branch, and/or tag. Args: app_id: Optional app ID to filter builds. If omitted, returns builds across all apps. branch: Optional branch name to filter builds (e.g. "main"). tag: Optional tag name to filter builds (e.g. "release_v5.57.2"). limit: Number of builds per page (default 10). page: Page number to retrieve, starting from 1 (default 1). """ async with CodemagicClient() as client: return await client.list_builds( app_id=app_id, branch=branch, tag=tag, limit=limit, page=page )