Skip to main content
Glama

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
NameRequiredDescriptionDefault
app_idNo
branchNo
tagNo
limitNo
pageNo

Implementation Reference

  • 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
            ],
        }
  • 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
                )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AgiMaulana/CodemagicMcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server