Skip to main content
Glama

gitlab_cancel_pipeline

Cancel a running GitLab pipeline by specifying the project path and pipeline ID. Use this tool to stop ongoing CI/CD processes when needed.

Instructions

Cancels a running pipeline.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe path of the GitLab project.
pipelineIdYesThe ID of the pipeline to cancel.

Implementation Reference

  • The core handler function in GitLabService that cancels a running GitLab pipeline by making a POST request to the GitLab API /pipelines/{id}/cancel endpoint.
    async cancelPipeline(projectPath: string, pipelineId: number): Promise<any> {
      const encodedProjectPath = encodeURIComponent(projectPath);
      return this.callGitLabApi<any>(
        `projects/${encodedProjectPath}/pipelines/${pipelineId}/cancel`,
        'POST',
      );
    }
  • src/index.ts:736-752 (registration)
    Tool registration in the allTools array, defining the name, description, and input schema for gitlab_cancel_pipeline.
    {
      name: 'gitlab_cancel_pipeline',
      description: 'Cancels a running pipeline.',
      inputSchema: {
        type: 'object',
        properties: {
          projectPath: {
            type: 'string',
            description: 'The path of the GitLab project.',
          },
          pipelineId: {
            type: 'number',
            description: 'The ID of the pipeline to cancel.',
          },
        },
        required: ['projectPath', 'pipelineId'],
      },
  • Dispatch handler in the CallToolRequestSchema switch statement that extracts arguments and calls the GitLabService.cancelPipeline method.
    case 'gitlab_cancel_pipeline': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const { projectPath, pipelineId } = args as { projectPath: string; pipelineId: number };
      const result = await gitlabService.cancelPipeline(projectPath, pipelineId);
      return {
        content: [
          {
            type: 'text',
            text: `Pipeline cancelled successfully: ${JSON.stringify(result, null, 2)}`,
          },
        ],
      };
    }
  • Input schema defining the parameters for the gitlab_cancel_pipeline tool: projectPath (string) and pipelineId (number).
    inputSchema: {
      type: 'object',
      properties: {
        projectPath: {
          type: 'string',
          description: 'The path of the GitLab project.',
        },
        pipelineId: {
          type: 'number',
          description: 'The ID of the pipeline to cancel.',
        },
      },
      required: ['projectPath', 'pipelineId'],
    },

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

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