Skip to content

Merge trains

A merge train queues merge requests into a target branch and tests each against the ones ahead of it before merging it. These actions list a project’s merge trains or the train of one target branch, read the train entry of a merge request, and add a merge request to its train.

  • “What is on the merge train for main?”
  • “Add merge request !15 to the merge train”
  • “Where is merge request !15 in the train?”
  • Dynamic, the default surface: call gitlab_execute_action with action set to the action’s ID, such as merge_train.add, and its parameters in params. gitlab_find_action finds an ID from a description of the task.
  • Meta (GITLAB_MCP_TOOL_SURFACE=meta): call gitlab_merge_train with action set to the action’s name, such as add, and its parameters in params.
  • Individual (GITLAB_MCP_TOOL_SURFACE=individual): call the action’s own tool, such as gitlab_add_merge_request_to_merge_train, with its parameters as the arguments.

How many of these actions an instance serves at each tier, out of a total of 4:

  • Free: 0
  • Premium: 4
  • Ultimate: 4

Read-only actions: 3 of 4, the ones a deployment in read-only mode keeps. A token with read_api and not api is served 3 of the 4.

The description of each action, and of each of its parameters, is the text the server serves for it on the default surface, quoted as served. The token lines say what GitLab 19.6.1 requires of a token for the requests each action sends; on an instance with Admin Mode turned on, an action only an administrator may run also needs admin_mode. A destructive action runs only once confirmed, unless GITLAB_MCP_YOLO_MODE (or AUTOPILOT) skips that step: the dynamic surface needs confirm: true on gitlab_execute_action, and the other two take a confirm parameter or the client’s prompt (Destructive actions).

Action Individual
merge_train.add gitlab_add_merge_request_to_merge_train
merge_train.get gitlab_get_merge_request_on_merge_train
merge_train.list_branch gitlab_list_merge_request_in_merge_train
merge_train.list_project gitlab_list_project_merge_trains

Add a merge request to a merge train. Requires confirmation. Returns: the resulting merge train entries with the merge request, user, pipeline, target branch, status, and duration. See also: merge_train.get, merge_train.list_branch, merge_train.list_project.

  • Meta-tool: gitlab_merge_train, action add
  • Individual tool: gitlab_add_merge_request_to_merge_train
  • Tier: Premium
  • Classic or OAuth token: api
  • Fine-grained token: Merge Train Merge Request: Add at project (permissions page)
  • Behavior: writes, destructive (needs confirmation), not idempotent
Parameter Type Mandatory Description
merge_request_iid integer yes Merge request internal ID
project_id string/integer yes Project ID or URL-encoded path
auto_merge boolean no Enable auto-merge when pipeline succeeds
sha string no Head SHA of the merge request to verify
squash boolean no Squash commits when merging
when_pipeline_succeeds boolean no Deprecated in 17.11. Use auto_merge instead. Merge only when the pipeline succeeds

Get the merge train status of a single merge request. Returns: the merge train entry with the merge request, user, pipeline, target branch, status, and duration. See also: merge_train.list_project, merge_train.list_branch, merge_train.add.

  • Meta-tool: gitlab_merge_train, action get
  • Individual tool: gitlab_get_merge_request_on_merge_train
  • Tier: Premium
  • Classic or OAuth token: read_api (or api)
  • Fine-grained token: Merge Train: Read at project (permissions page)
  • Behavior: read-only, idempotent
Parameter Type Mandatory Description
merge_request_iid integer yes Merge request internal ID
project_id string/integer yes Project ID or URL-encoded path

List the merge requests on a merge train for a target branch. Returns: merge train entries with the merge request, user, pipeline, status, duration, and pagination metadata. See also: merge_train.list_project, merge_train.get, merge_train.add.

  • Meta-tool: gitlab_merge_train, action list_branch
  • Individual tool: gitlab_list_merge_request_in_merge_train
  • Tier: Premium
  • Classic or OAuth token: read_api (or api)
  • Fine-grained token: Merge Train: Read at project (permissions page)
  • Behavior: read-only, idempotent
Parameter Type Mandatory Description
project_id string/integer yes Project ID or URL-encoded path
target_branch string yes Target branch name
order_by string no Column to order results by
page integer no Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
per_page integer no Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
scope string (active, complete) no Filter by scope: active, complete
sort string (asc, desc) no Sort order: asc or desc

List all merge trains in a project. Returns: merge train entries with the merge request, user, pipeline, target branch, status, duration, and pagination metadata. See also: merge_train.list_branch, merge_train.get, merge_train.add.

  • Meta-tool: gitlab_merge_train, action list_project
  • Individual tool: gitlab_list_project_merge_trains
  • Tier: Premium
  • Classic or OAuth token: read_api (or api)
  • Fine-grained token: Merge Train: Read at project (permissions page)
  • Behavior: read-only, idempotent
Parameter Type Mandatory Description
project_id string/integer yes Project ID or URL-encoded path
order_by string no Column to order results by
page integer no Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
per_page integer no Items per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
scope string (active, complete) no Filter by scope: active, complete
sort string (asc, desc) no Sort order: asc or desc