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
| Name | Required | Description | Default |
|---|---|---|---|
| repo_slug | Yes | ||
| commit | Yes | ||
| limit | No |
Implementation Reference
- src/server.py:832-856 (handler)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], }
- src/bitbucket_client.py:888-908 (helper)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, )
- src/models.py:568-595 (schema)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"), )