Merge Merge Request Tool
merge_merge_request_toolMerge a GitLab merge request only when the source branch head still matches a required commit SHA, or schedule it to merge once the pipeline succeeds.
Instructions
Merge a merge request, or set it to merge when its pipeline succeeds.
sha is required and must be the full commit ID of the source branch head (the MR's "sha" field): GitLab merges only if the head is still that commit, so nothing pushed after review can slip in. A draft, a conflict, a closed MR or a moved head is refused without merging. Check CI first with get_mr_pipelines.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>",
"merge_request_iid": "<merge_request_iid>",
"sha": "<sha>"
},
"name": "merge_merge_request_tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha | Yes | Full commit ID the source branch head must be | |
| squash | No | Squash commits on merge (omit to keep the MR's setting) | |
| project_id | Yes | Project ID or path | |
| merge_request_iid | Yes | Merge request internal ID | |
| should_remove_source_branch | No | Remove the source branch (omit to keep the MR's setting) | |
| merge_when_pipeline_succeeds | No | Merge once the head pipeline passes (default: false) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||