Batch apply merge request suggestions
batch_apply_merge_request_suggestionsApply multiple GitLab merge request code suggestions in one commit with preflight checks for validity and head SHA match, rejecting the batch if any suggestion fails validation.
Instructions
Apply multiple GitLab code suggestions in a single commit using the batch Suggestions API at PUT /suggestions/batch_apply. Performs preflight validation on every suggestion before any mutation: confirms each belongs to the specified project/MR, is still applicable, has not already been applied, and that the MR head SHA matches the caller's expected value. If any suggestion is invalid the entire batch is rejected before calling GitLab's batch-apply endpoint. Returns an array of suggestion states. An explicit acknowledgement is required. Note: GitLab's batch-apply endpoint does not accept an expected-head parameter, so a TOCTOU race is possible between preflight and mutation; the server remains authoritative at mutation time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Suggestion IDs to apply in a single batch (1–50 suggestions). | |
| project | Yes | GitLab project ID or full path such as group/project. | |
| acknowledge | Yes | Must be true to confirm the suggestions should be applied. | |
| commit_message | No | ||
| expected_head_sha | Yes | The MR head SHA the caller last reviewed. The tool rejects the batch if the current MR head differs. | |
| merge_request_iid | Yes | Project-scoped internal ID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | GitLab response normalized for model use. |