Skip to main content
Glama

get_commit_statuses

Retrieve CI/CD build and check statuses for a specific commit in Bitbucket repositories to monitor pipeline execution and deployment readiness.

Instructions

Get build/CI statuses for a commit.

Args:
    repo_slug: Repository slug
    commit: Commit hash
    limit: Maximum number of results (default: 20)

Returns:
    List of CI/CD statuses (builds, checks) for the commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
commitYes
limitNo

Implementation Reference

  • The primary MCP tool handler for 'get_commit_statuses'. Registers the tool with @mcp.tool(), validates limit, fetches statuses via BitbucketClient, formats using CommitStatus model, and returns structured JSON response.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def get_commit_statuses(
        repo_slug: str,
        commit: str,
        limit: int = 20,
    ) -> dict:
        """Get build/CI statuses for a commit.
    
        Args:
            repo_slug: Repository slug
            commit: Commit hash
            limit: Maximum number of results (default: 20)
    
        Returns:
            List of CI/CD statuses (builds, checks) for the commit
        """
        client = get_client()
        statuses = client.get_commit_statuses(repo_slug, commit, limit=validate_limit(limit))
        return {
            "commit": truncate_hash(commit),
            "statuses": [CommitStatus.from_api(s).model_dump() for s in statuses],
        }
  • BitbucketClient helper method that makes the paginated API request to retrieve commit statuses from Bitbucket Cloud API.
    def get_commit_statuses(
        self,
        repo_slug: str,
        commit: str,
        limit: int = 20,
    ) -> list[dict[str, Any]]:
        """Get build/CI statuses for a commit.
    
        Args:
            repo_slug: Repository slug
            commit: Commit hash
            limit: Maximum results to return
    
        Returns:
            List of status info dicts
        """
        return self._paginated_list(
            self._repo_path(repo_slug, "commit", commit, "statuses"),
            limit=limit,
        )
  • Pydantic model defining the output schema for commit statuses. Used by the handler to parse and validate/format API responses before returning to MCP client.
    class CommitStatus(BaseModel):
        """Commit status info."""
    
        key: str
        name: Optional[str] = None
        state: str
        description: str = ""
        url: Optional[str] = None
        created: Optional[str] = None
        updated: Optional[str] = None
    
        @field_validator("created", "updated", mode="before")
        @classmethod
        def truncate_ts(cls, v: Any) -> Optional[str]:
            return truncate_timestamp(v)
    
        @classmethod
        def from_api(cls, data: dict) -> "CommitStatus":
            return cls(
                key=data.get("key", ""),
                name=data.get("name"),
                state=data.get("state", ""),
                description=data.get("description", ""),
                url=data.get("url"),
                created=data.get("created_on"),
                updated=data.get("updated_on"),
            )

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/JaviMaligno/mcp-server-bitbucket'

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