Skip to main content
Glama
Alosies
by Alosies

create_merge_request

Create a new merge request in GitLab by specifying source and target branches, title, description, assignees, reviewers, labels, and milestone for code review and integration.

Instructions

Create a new merge request

Input Schema

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

Implementation Reference

  • The handler function that implements the create_merge_request tool by constructing the request data and calling the GitLab API to POST /projects/{project_id}/merge_requests.
    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), }, ], }; }
  • The MCP tool schema definition for create_merge_request, including inputSchema used for validation.
    { 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'], },
  • src/server.ts:185-188 (registration)
    Server-side registration and dispatching of the create_merge_request tool call to the handler.
    case "create_merge_request": return await this.mergeRequestHandlers.createMergeRequest( args as unknown as CreateMergeRequestParams );
  • TypeScript interface defining the 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; }

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