Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

list_mr_notes

Retrieve all comments and notes from a GitLab merge request to review discussions and track feedback.

Instructions

List all notes (comments) on a merge request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
merge_request_iidYesMerge request internal ID
sortNoSort order (asc or desc)desc
order_byNoField to order bycreated_at
pageNoPage number for pagination (default: 1)
per_pageNoNumber of results per page (max 100)

Implementation Reference

  • The main handler function that executes the tool logic: fetches MR notes from GitLab API using the provided parameters and returns JSON response.
    async listMRNotes(args: ListMRNotesParams) {
      const params = new URLSearchParams();
    
      if (args.sort) params.append("sort", args.sort);
      if (args.order_by) params.append("order_by", args.order_by);
      if (args.page) params.append("page", String(args.page));
      params.append("per_page", String(args.per_page || 20));
    
      const data = await this.client.get(
        `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${
          args.merge_request_iid
        }/notes?${params.toString()}`
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
  • Tool registration with input schema definition for validating parameters like project_id, merge_request_iid, sort, etc.
    {
      name: 'list_mr_notes',
      description: 'List all notes (comments) 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',
          },
          sort: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Sort order (asc or desc)',
            default: 'desc',
          },
          order_by: {
            type: 'string',
            enum: ['created_at', 'updated_at'],
            description: 'Field to order by',
            default: 'created_at',
          },
          page: {
            type: 'number',
            description: 'Page number for pagination (default: 1)',
            minimum: 1,
            default: 1,
          },
          per_page: {
            type: 'number',
            description: 'Number of results per page (max 100)',
            maximum: 100,
            default: 20,
          },
        },
        required: ['project_id', 'merge_request_iid'],
      },
    },
  • src/server.ts:207-210 (registration)
    Server dispatch/registration that maps tool call to the handler method.
    case "list_mr_notes":
      return await this.mergeRequestHandlers.listMRNotes(
        args as unknown as ListMRNotesParams
      );
  • TypeScript interface defining the input parameters for the list_mr_notes tool.
    export interface ListMRNotesParams {
      project_id: string;
      merge_request_iid: number;
      sort?: 'asc' | 'desc';
      order_by?: 'created_at' | 'updated_at';
      page?: number;
      per_page?: number;
    }

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