Protect branch
protect_branchCreate a protected-branch policy by defining push/merge permissions and an unprotect rule, with explicit acknowledgment to prevent accidental lockout.
Instructions
Create protected-branch policy after a capability preflight. An explicit acknowledgement and unprotect rule are required to avoid accidental lockout.
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": "<project>",
"name": "<name>",
"allowed_to_unprotect": "<allowed_to_unprotect>",
"acknowledge_protection_change": "<acknowledge_protection_change>"
},
"name": "protect_branch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| project | Yes | GitLab project ID or full path such as group/project. | |
| allowed_to_push | No | ||
| allow_force_push | No | ||
| allowed_to_merge | No | ||
| allowed_to_unprotect | Yes | ||
| code_owner_approval_required | No | ||
| acknowledge_protection_change | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes | GitLab response normalized for model use. |