Merge pull request at exact head
gh_merge_prMerge a single GitHub pull request only when its head SHA matches the expected value, using the specified merge, squash, or rebase strategy. Requires standard write permission and the PR-merge gate; no admin bypass or branch deletion.
Instructions
Destructive write: merge exactly one pull request using the explicit merge strategy only while its head matches expected_head_sha. Ordinary write authorization and the separate PR-merge fine gate are required. The tool cannot use administrator bypass, delete the branch, force a changed revision, or blindly retry an ambiguous merge.
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": {
"owner": "<owner>",
"repo": "<repo>",
"number": "<number>",
"expected_head_sha": "<expected_head_sha>",
"method": "<method>"
},
"name": "gh_merge_pr"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Optional merge commit body. | |
| repo | Yes | GitHub repository name without the owner prefix. | |
| owner | Yes | GitHub repository owner or organization login. | |
| method | Yes | Repository-supported merge strategy. | |
| number | Yes | Pull request number to merge. | |
| subject | No | Optional merge commit subject. | |
| expected_head_sha | Yes | Exact pull-request head SHA authorized for merge. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| state | Yes | ||
| merged | Yes | ||
| method | Yes | ||
| number | Yes | ||
| message | Yes | ||
| warning | No | ||
| head_sha | Yes | ||
| merged_at | No | ||
| request_id | No | ||
| merge_queued | No | ||
| write_completed | Yes | ||
| merge_commit_sha | No | ||
| auto_merge_enabled | No | ||
| merge_state_status | No | ||
| readback_completed | Yes | ||
| precondition_checked | Yes | ||
| state_matches_requested | Yes |