cancel_pipeline
Stop a running CI/CD pipeline in GitLab by providing project and pipeline IDs to halt ongoing builds and deployments.
Instructions
取消 Pipeline
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| pipeline_id | Yes |
Implementation Reference
- src/gitlab_mcp/server.py:624-636 (handler)The tool handler for cancel_pipeline in the MCP server.
def cancel_pipeline(project_id: int | str, pipeline_id: int) -> str: """取消 Pipeline Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID """ try: client = get_client() p = client.cancel_pipeline(project_id, pipeline_id) return f"✓ Pipeline #{p['id']} 已取消 | 狀態: {p.get('status', 'N/A')}" except GitLabAPIError as e: return f"取消 Pipeline 失敗: {str(e)}" - src/gitlab_mcp/server.py:623-623 (registration)Registration of the cancel_pipeline tool.
@mcp.tool() - The underlying GitLab API client method called by the MCP tool.
def cancel_pipeline(self, project_id: int | str, pipeline_id: int) -> dict: """POST /projects/:id/pipelines/:pipeline_id/cancel""" pid = self._resolve_project_id(project_id) return self._post_json(f"/projects/{pid}/pipelines/{pipeline_id}/cancel")