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.

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.

ActionIndividual
merge_train.addgitlab_add_merge_request_to_merge_train
merge_train.getgitlab_get_merge_request_on_merge_train
merge_train.list_branchgitlab_list_merge_request_in_merge_train
merge_train.list_projectgitlab_list_project_merge_trains

Add a merge request to a merge train. 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
  • Behavior: writes, not idempotent
ParameterTypeMandatoryDescription
merge_request_iidintegeryesMerge request internal ID
project_idstring/integeryesProject ID or URL-encoded path
auto_mergebooleannoEnable auto-merge when pipeline succeeds
shastringnoHead SHA of the merge request to verify
squashbooleannoSquash commits when merging
when_pipeline_succeedsbooleannoDeprecated 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
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
merge_request_iidintegeryesMerge request internal ID
project_idstring/integeryesProject 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
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
target_branchstringyesTarget branch name
order_bystringnoColumn to order results by (keyset pagination)
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
scopestring (active, complete)noFilter by scope: active, complete
sortstring (asc, desc)noSort 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
  • Behavior: read-only, idempotent
ParameterTypeMandatoryDescription
project_idstring/integeryesProject ID or URL-encoded path
order_bystringnoColumn to order results by (keyset pagination)
pageintegernoPage number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward.
page_tokenstringnoKeyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’.
paginationstringnoPagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost.
per_pageintegernoItems per page. Defaults to 20, minimum 1, maximum 100. Use 100 to minimize round trips when the result set is large.
scopestring (active, complete)noFilter by scope: active, complete
sortstring (asc, desc)noSort order: asc or desc