Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

list_mr_templates

Retrieve available merge request description templates for a GitLab project to standardize documentation and streamline code review processes.

Instructions

List available merge request description templates in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path

Implementation Reference

  • The core handler function that executes the list_mr_templates tool logic by fetching merge request templates from the GitLab API endpoint `/projects/{project_id}/templates/merge_requests` and returning a formatted MCP response with the JSON-stringified data.
    async listMRTemplates(args: ListMRTemplatesParams) {
      const data = await this.client.get(
        `/projects/${encodeURIComponent(
          args.project_id
        )}/templates/merge_requests`
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • src/server.ts:255-258 (registration)
    Dispatches tool calls for 'list_mr_templates' to the corresponding handler method in the main server switch statement.
    case "list_mr_templates":
      return await this.mergeRequestHandlers.listMRTemplates(
        args as unknown as ListMRTemplatesParams
      );
  • Defines the MCP tool metadata including name, description, and JSON input schema for 'list_mr_templates', part of the tools export array.
      name: 'list_mr_templates',
      description:
        'List available merge request description templates in a project',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
        },
        required: ['project_id'],
      },
    },
  • TypeScript type definition for the input parameters of the list_mr_templates handler.
    export interface ListMRTemplatesParams {
      project_id: string;
    }

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