Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

mark_mr_as_ready

Change a GitLab merge request from draft to ready for review by removing its draft status.

Instructions

Mark a merge request as ready (remove draft status, ready for review)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
merge_request_iidYesMerge request internal ID

Implementation Reference

  • The main handler function that implements the mark_mr_as_ready tool logic: fetches the MR, checks for draft/WIP prefix in title, removes it if present by updating the MR title, or returns a message if already ready.
    async markMRAsReady(args: MarkMRAsReadyParams) {
      // First get the current MR to check its title
      const mr = (await this.client.get(
        `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${
          args.merge_request_iid
        }`
      )) as GitLabMergeRequest;
    
      // Check if it's a draft and remove the prefix
      let newTitle = mr.title;
      if (mr.title.startsWith("Draft: ")) {
        newTitle = mr.title.replace(/^Draft: /, "");
      } else if (mr.title.startsWith("WIP: ")) {
        newTitle = mr.title.replace(/^WIP: /, "");
      } else {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { message: "Merge request is already marked as ready", ...mr },
                null,
                2
              ),
            },
          ],
        };
      }
    
      // Update the title to remove the draft prefix
      const data = await this.client.put(
        `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${
          args.merge_request_iid
        }`,
        { title: newTitle }
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Tool registration definition including name, description, and input schema for the MCP listTools response.
      name: 'mark_mr_as_ready',
      description:
        'Mark a merge request as ready (remove draft status, ready for review)',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          merge_request_iid: {
            type: 'number',
            description: 'Merge request internal ID',
          },
        },
        required: ['project_id', 'merge_request_iid'],
      },
    },
  • TypeScript interface defining the input parameters for the markMRAsReady handler.
    export interface MarkMRAsReadyParams {
      project_id: string;
      merge_request_iid: number;
    }
  • src/server.ts:251-254 (registration)
    Dispatch case in the main server tool call handler that routes the tool invocation to the merge request handler.
    case "mark_mr_as_ready":
      return await this.mergeRequestHandlers.markMRAsReady(
        args as unknown as MarkMRAsReadyParams
      );

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