Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

cancel_pipeline

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

Instructions

Cancel a running pipeline

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
pipeline_idYesPipeline ID

Implementation Reference

  • The cancelPipeline handler function that executes the tool logic by calling the GitLab API to POST /projects/{project_id}/pipelines/{pipeline_id}/cancel and returns the JSON response.
    async cancelPipeline(args: PipelineActionParams) {
      const data = await this.client.post(`/projects/${encodeURIComponent(args.project_id)}/pipelines/${args.pipeline_id}/cancel`);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • The tool specification including name, description, and input schema requiring project_id (string) and pipeline_id (number).
    {
      name: 'cancel_pipeline',
      description: 'Cancel a running pipeline',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          pipeline_id: {
            type: 'number',
            description: 'Pipeline ID',
          },
        },
        required: ['project_id', 'pipeline_id'],
      },
    },
  • src/server.ts:303-306 (registration)
    Tool call dispatching in the server's CallToolRequestSchema handler switch statement, routing 'cancel_pipeline' calls to pipelineHandlers.cancelPipeline.
    case "cancel_pipeline":
      return await this.pipelineHandlers.cancelPipeline(
        args as unknown as PipelineActionParams
      );

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

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