View as Markdown
GitLab icon

GitLab ACTION

Create Merge Request

Open a new merge request from one branch into another. Use this for "open an MR", "raise a merge request", "submit my branch for review". Both branches must already exist in the project — use List Repo Branches to check, or Create Branch to make one. Reviewers and assignees are given as usernames and resolved to IDs automatically; a username that is not a member of the project is rejected rather than silently dropped. Set Draft to true for work that is not ready for review — GitLab expresses this by prefixing the title with Draft:, which this action does for you and which blocks merging until removed. After creating, use Get Merge Request to check its pipeline and merge readiness. See the documentation
  • Action
  • Writes data
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's GitLab account once, then configure and run Create Merge Request from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "gitlab-create-merge-request",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    gitlab: { authProvisionId: "apn_xxxxxxx" },
    projectId: "Project",
    sourceBranch: "Source Branch",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Create Merge Request inputs
Property Type Description
projectId Project string
The project, given either as its path — group/project or group/subgroup/project, e.g. backend/payments — or as its numeric project ID. The path is what appears in the project URL and is usually what a user will name, so prefer it. A pasted GitLab URL also works. Use List Projects to find the path if you only know part of the name.
Required
sourceBranch Source Branch string
The branch holding the changes, e.g. feat/retry-cap. Must already exist in the project — use List Repo Branches to check.
Required
targetBranch Target Branch string
The branch to merge into, e.g. main or master. Use List Repo Branches to confirm the project's default branch rather than assuming main.
Required
title Title string
The merge request title. Do not prefix it with Draft: by hand — set Draft instead.
Required
description Description string
The merge request description, in GitLab-flavored Markdown. Mentioning Closes #123 links and closes that issue on merge.
Optional
draft Draft boolean
Whether to open the merge request as a draft, which blocks merging until the draft flag is removed. Defaults to false.
Optional
reviewerUsernames Reviewer Usernames string[]
Usernames to request review from, e.g. ["jdoe"]. Resolved to user IDs automatically; each must be a member of the project.
Optional
assigneeUsernames Assignee Usernames string[]
Usernames to assign the merge request to. Resolved to user IDs automatically; each must be a member of the project.
Optional
labels Labels string[]
Labels to apply to the merge request, by name. Each must already exist in the project — GitLab creates a label it does not recognize rather than rejecting it, so a mis-cased or invented name silently adds a new project label. Use List Project Labels to get the exact names.
Optional
removeSourceBranch Remove Source Branch boolean
Whether to delete the source branch when the merge request is merged. Defaults to the project's own setting when left blank.
Optional
squash Squash boolean
Whether to squash the commits into one when merging.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
gitlab-create-merge-request
Version
0.0.1
App
GitLab
Authentication
OAuth
Read-only
No
Destructive
No
Open world
Yes