Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYes
pipeline_idYes

Implementation Reference

  • 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)}"
  • 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")

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/snowild/gitlab-mcp'

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