Skip to main content
Glama
Alosies
by Alosies

create_merge_request

Create a merge request to propose code changes from a source branch to a target branch in a GitLab project, enabling code review and integration.

Instructions

Create a new merge request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
titleYesMerge request title
source_branchYesSource branch name
target_branchYesTarget branch name
descriptionNoMerge request description
assignee_idsNoArray of user IDs to assign
reviewer_idsNoArray of user IDs to review
labelsNoComma-separated list of labels
milestone_idNoMilestone ID

Implementation Reference

  • The main handler function in MergeRequestHandlers class that executes the create merge request logic by constructing the request payload and calling the GitLab API POST endpoint.
    async createMergeRequest(args: CreateMergeRequestParams) { const requestData: any = { title: args.title, source_branch: args.source_branch, target_branch: args.target_branch, }; if (args.description) { requestData.description = args.description; } if (args.assignee_ids) requestData.assignee_ids = args.assignee_ids; if (args.reviewer_ids) requestData.reviewer_ids = args.reviewer_ids; if (args.labels) requestData.labels = args.labels; if (args.milestone_id) requestData.milestone_id = args.milestone_id; const data = await this.client.post( `/projects/${encodeURIComponent(args.project_id)}/merge_requests`, requestData ); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
  • MCP tool definition for 'create_merge_request' including the detailed inputSchema used for validation and documentation.
    name: 'create_merge_request', description: 'Create a new merge request', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Project ID or path', }, title: { type: 'string', description: 'Merge request title', }, source_branch: { type: 'string', description: 'Source branch name', }, target_branch: { type: 'string', description: 'Target branch name', }, description: { type: 'string', description: 'Merge request description', }, assignee_ids: { type: 'array', items: { type: 'number' }, description: 'Array of user IDs to assign', }, reviewer_ids: { type: 'array', items: { type: 'number' }, description: 'Array of user IDs to review', }, labels: { type: 'string', description: 'Comma-separated list of labels', }, milestone_id: { type: 'number', description: 'Milestone ID', }, }, required: ['project_id', 'title', 'source_branch', 'target_branch'], },
  • TypeScript interface defining the input parameters for the createMergeRequest handler.
    export interface CreateMergeRequestParams { project_id: string; title: string; source_branch: string; target_branch: string; description?: string; assignee_ids?: number[]; reviewer_ids?: number[]; labels?: string; milestone_id?: number; }
  • src/server.ts:185-188 (registration)
    Dispatch registration in the main server switch statement that routes 'create_merge_request' tool calls to the appropriate handler method.
    case "create_merge_request": return await this.mergeRequestHandlers.createMergeRequest( args as unknown as CreateMergeRequestParams );

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