list_deployment_history
Retrieve deployment history for a Bitbucket environment to track status, commits, and timestamps for monitoring and auditing purposes.
Instructions
Get deployment history for a specific environment.
Args:
repo_slug: Repository slug
environment_uuid: Environment UUID (from list_environments)
limit: Maximum number of results (default: 20)
Returns:
List of deployments with status, commit, and timestamps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_slug | Yes | ||
| environment_uuid | Yes | ||
| limit | No |
Implementation Reference
- src/server.py:1142-1167 (handler)MCP tool handler for list_deployment_history: validates params, calls BitbucketClient method, formats output with DeploymentSummary Pydantic models.@mcp.tool() @handle_bitbucket_error @formatted def list_deployment_history( repo_slug: str, environment_uuid: str, limit: int = 20, ) -> dict: """Get deployment history for a specific environment. Args: repo_slug: Repository slug environment_uuid: Environment UUID (from list_environments) limit: Maximum number of results (default: 20) Returns: List of deployments with status, commit, and timestamps """ client = get_client() deployments = client.list_deployment_history( repo_slug, environment_uuid, limit=validate_limit(limit) ) return { "deployments": [DeploymentSummary.from_api(d).model_dump() for d in deployments], }
- src/bitbucket_client.py:1132-1154 (helper)BitbucketClient method implementing the API call to list deployment history using paginated requests to /deployments endpoint.def list_deployment_history( self, repo_slug: str, environment_uuid: str, limit: int = 20, ) -> list[dict[str, Any]]: """Get deployment history for an environment. Args: repo_slug: Repository slug environment_uuid: Environment UUID limit: Maximum results to return Returns: List of deployment info dicts """ environment_uuid = ensure_uuid_braces(environment_uuid) return self._paginated_list( self._repo_path(repo_slug, "deployments"), limit=limit, environment=environment_uuid, sort="-state.started_on", )
- src/models.py:505-532 (schema)Pydantic model DeploymentSummary for structured output of deployment history entries, with from_api factory method.class DeploymentSummary(BaseModel): """Deployment info for history responses.""" uuid: str state: Optional[str] = None commit: str = "" pipeline_uuid: Optional[str] = None started: Optional[str] = None completed: Optional[str] = None @field_validator("started", "completed", mode="before") @classmethod def truncate_ts(cls, v: Any) -> Optional[str]: return truncate_timestamp(v) @classmethod def from_api(cls, data: dict) -> "DeploymentSummary": state_data = data.get("state") or {} release = data.get("release") or {} pipeline = release.get("pipeline") or {} return cls( uuid=data.get("uuid", ""), state=state_data.get("name"), commit=((data.get("commit") or {}).get("hash") or "")[:12], pipeline_uuid=pipeline.get("uuid"), started=state_data.get("started_on"), completed=state_data.get("completed_on"), )