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.
Sample questions
Section titled “Sample questions”- “What is on the merge train for main?”
- “Add merge request !15 to the merge train”
- “Where is merge request !15 in the train?”
How to call it
Section titled “How to call it”- Dynamic, the default surface: call
gitlab_execute_actionwithactionset to the action’s ID, such asmerge_train.add, and its parameters inparams.gitlab_find_actionfinds an ID from a description of the task. - Meta (
GITLAB_MCP_TOOL_SURFACE=meta): callgitlab_merge_trainwithactionset to the action’s name, such asadd, and its parameters inparams. - Individual (
GITLAB_MCP_TOOL_SURFACE=individual): call the action’s own tool, such asgitlab_add_merge_request_to_merge_train, with its parameters as the arguments.
Availability
Section titled “Availability”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.
Actions
Section titled “Actions”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.
| 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 |
merge_train.add
Section titled “merge_train.add”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, actionadd - Individual tool:
gitlab_add_merge_request_to_merge_train - Tier: Premium
- Behavior: writes, 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 |
merge_train.get
Section titled “merge_train.get”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, actionget - Individual tool:
gitlab_get_merge_request_on_merge_train - Tier: Premium
- 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 |
merge_train.list_branch
Section titled “merge_train.list_branch”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, actionlist_branch - Individual tool:
gitlab_list_merge_request_in_merge_train - Tier: Premium
- 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 (keyset pagination) |
page | integer | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
page_token | string | no | Keyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’. |
pagination | string | no | Pagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost. |
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 |
merge_train.list_project
Section titled “merge_train.list_project”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, actionlist_project - Individual tool:
gitlab_list_project_merge_trains - Tier: Premium
- 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 (keyset pagination) |
page | integer | no | Page number to fetch, 1-based. Defaults to 1. Use the next_page field from the previous response to paginate forward. |
page_token | string | no | Keyset pagination cursor: record id at which to fetch the next page, taken from the previous keyset response. Only used when pagination=‘keyset’. |
pagination | string | no | Pagination method: ‘keyset’ for keyset-based pagination on large ordered result sets, or ‘offset’ (the default). Keyset avoids deep-offset cost. |
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 |