Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

reply_to_mr_discussion

Add responses to merge request discussion threads to provide feedback, answer questions, or resolve comments during code review.

Instructions

Reply to an existing discussion thread on a merge request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
merge_request_iidYesMerge request internal ID
discussion_idYesThe ID of the discussion to reply to
bodyYesThe content of the reply (supports Markdown)

Implementation Reference

  • The core handler function that executes the tool by posting a reply note to the specified GitLab merge request discussion via API.
    async replyToMRDiscussion(args: ReplyToMRDiscussionParams) {
      const requestData = {
        body: args.body,
      };
    
      const data = await this.client.post(
        `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${
          args.merge_request_iid
        }/discussions/${args.discussion_id}/notes`,
        requestData
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • TypeScript interface defining the input parameters for the replyToMRDiscussion handler.
    export interface ReplyToMRDiscussionParams {
      project_id: string;
      merge_request_iid: number;
      discussion_id: string;
      body: string;
    }
  • Tool registration including name, description, and input schema for MCP protocol.
    {
      name: 'reply_to_mr_discussion',
      description: 'Reply to an existing discussion thread on a merge request',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          merge_request_iid: {
            type: 'number',
            description: 'Merge request internal ID',
          },
          discussion_id: {
            type: 'string',
            description: 'The ID of the discussion to reply to',
          },
          body: {
            type: 'string',
            description: 'The content of the reply (supports Markdown)',
          },
        },
        required: ['project_id', 'merge_request_iid', 'discussion_id', 'body'],
      },
    },
  • src/server.ts:223-226 (registration)
    Dispatch logic in server that routes the tool call to the merge request handler.
    case "reply_to_mr_discussion":
      return await this.mergeRequestHandlers.replyToMRDiscussion(
        args as unknown as ReplyToMRDiscussionParams
      );

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