Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

get_mr_template

Retrieve a specific merge request description template from a GitLab project to standardize documentation and streamline code review processes.

Instructions

Get a specific merge request description template by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
nameYesTemplate name (without .md extension)

Implementation Reference

  • The core handler function for the get_mr_template tool. It fetches the specified merge request template from the GitLab project using the API endpoint `/projects/{project_id}/templates/merge_requests/{name}` and returns the content as a JSON-formatted text response in MCP format.
    async getMRTemplate(args: GetMRTemplateParams) {
      const data = await this.client.get(
        `/projects/${encodeURIComponent(
          args.project_id
        )}/templates/merge_requests/${encodeURIComponent(args.name)}`
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • TypeScript interface defining the input parameters for the get_mr_template handler: project_id (string) and name (string).
    export interface GetMRTemplateParams {
      project_id: string;
      name: string;
    }
  • MCP tool registration defining the name, description, and JSON Schema for input validation of the get_mr_template tool.
      name: 'get_mr_template',
      description: 'Get a specific merge request description template by name',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          name: {
            type: 'string',
            description: 'Template name (without .md extension)',
          },
        },
        required: ['project_id', 'name'],
      },
    },
  • src/server.ts:259-262 (registration)
    Dispatch logic in the main MCP server switch statement that routes tool calls named 'get_mr_template' to the MergeRequestHandlers.getMRTemplate method.
    case "get_mr_template":
      return await this.mergeRequestHandlers.getMRTemplate(
        args as unknown as GetMRTemplateParams
      );

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