get_pipeline_logs
Retrieve pipeline execution logs or list available steps for debugging Bitbucket CI/CD workflows. Provide repository slug and pipeline UUID to access detailed run information.
Instructions
Get logs for a pipeline run.
If step_uuid is not provided, returns list of steps to choose from.
Args:
repo_slug: Repository slug
pipeline_uuid: Pipeline UUID
step_uuid: Step UUID (optional, get from steps list first)
Returns:
Pipeline logs or list of available steps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_slug | Yes | ||
| pipeline_uuid | Yes | ||
| step_uuid | No |
Implementation Reference
- src/server.py:428-461 (handler)MCP tool handler for 'get_pipeline_logs'. Lists pipeline steps if no step_uuid provided, otherwise fetches and returns logs for the specific step using the BitbucketClient.def get_pipeline_logs( repo_slug: str, pipeline_uuid: str, step_uuid: Optional[str] = None, ) -> dict: """Get logs for a pipeline run. If step_uuid is not provided, returns list of steps to choose from. Args: repo_slug: Repository slug pipeline_uuid: Pipeline UUID step_uuid: Step UUID (optional, get from steps list first) Returns: Pipeline logs or list of available steps """ client = get_client() if not step_uuid: # Return list of steps steps = client.get_pipeline_steps(repo_slug, pipeline_uuid) return { "message": "Provide step_uuid to get logs for a specific step", "steps": [PipelineStep.from_api(s).model_dump() for s in steps], } # Get logs for specific step logs = client.get_pipeline_logs(repo_slug, pipeline_uuid, step_uuid) return { "step_uuid": step_uuid, "logs": logs if logs else "(no logs available)", }
- src/bitbucket_client.py:598-620 (helper)BitbucketClient helper method that performs the actual API request to retrieve pipeline step logs.def get_pipeline_logs( self, repo_slug: str, pipeline_uuid: str, step_uuid: str, ) -> str: """Get logs for a pipeline step. Args: repo_slug: Repository slug pipeline_uuid: Pipeline UUID step_uuid: Step UUID Returns: Log content as string """ pipeline_uuid = ensure_uuid_braces(pipeline_uuid) step_uuid = ensure_uuid_braces(step_uuid) path = self._repo_path( repo_slug, "pipelines", pipeline_uuid, "steps", step_uuid, "log" ) return self._request_text(path) or ""
- src/models.py:320-338 (schema)Pydantic model PipelineStep used for typing and serializing pipeline step information in the tool's output when listing steps.class PipelineStep(BaseModel): """Pipeline step info.""" uuid: str name: Optional[str] = None state: Optional[str] = None result: Optional[str] = None @classmethod def from_api(cls, data: dict) -> "PipelineStep": state_data = data.get("state") or {} result_data = state_data.get("result") or {} return cls( uuid=data.get("uuid", ""), name=data.get("name"), state=state_data.get("name"), result=result_data.get("name") if result_data else None, )
- src/server.py:428-428 (registration)MCP tool registration decorator @mcp.tool() applied to the get_pipeline_logs handler function.def get_pipeline_logs(