Repository navigation
feat(pull_requests): add merge queue tools - #3868
Open
Mystery01092000 wants to merge 1 commit into
Open
Mystery01092000 wants to merge 1 commit into
Mystery01092000 wants to merge 1 commit into
Conversation
Repositories that require a merge queue reject merge_pull_request, so MCP clients had to fall back to the gh CLI or raw GraphQL to land a pull request there. - enqueue_pull_request wraps the enqueuePullRequest mutation, with the optional jump flag and expectedHeadSha (expectedHeadOid). - dequeue_pull_request wraps dequeuePullRequest. - pull_request_read gains a get_merge_queue_status method. It reports whether the base branch requires a merge queue and, if the pull request is queued, its position, state, enqueue time, estimated time to merge and jump/solo flags. Both write tools return the merge queue entry. The pull-request-authoring skill now maps both tools and says when to enqueue instead of merging. Fixes github#3669
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The new GraphQL queue mutations can trigger automatic merges and reorder work, introducing interactions with branch rules, merge authorization, and dequeue semantics beyond limited-consequence review scope.
No open issues 🎉
What changed in this PR
Adds merge queue support to the GitHub MCP Server’s pull_requests toolset, allowing clients to manage queue-based merges without falling back to the CLI or raw GraphQL. This addresses #3669 while keeping merge queues separate from auto-merge.
Changes:
- Adds enqueue and dequeue tools, including optional queue priority and expected-head protection.
- Extends
pull_request_readwith queue status and typed output schemas. - Adds regression coverage, schema snapshots, generated documentation, and skill guidance.
| File | Description |
|---|---|
| README.md | Documents queue tools and the new read method. |
| pkg/skills/catalog/tools.go | Maps queue tools to the authoring skill. |
| pkg/skills/catalog/skills/pull-request-authoring/SKILL.md | Explains queue selection and confirmation requirements. |
| pkg/github/typed_consolidated_pull_request_outputs_test.go | Covers queue outputs through MCP sessions. |
| pkg/github/tools.go | Registers enqueue and dequeue tools. |
| pkg/github/pullrequests.go | Routes the queue-status read method. |
| pkg/github/pullrequests_merge_queue.go | Implements GraphQL queue operations and response types. |
| pkg/github/pullrequests_merge_queue_test.go | Tests inputs, errors, status responses, and schemas. |
| pkg/github/consolidated_pull_request_types.go | Adds queue output schemas and argument normalization. |
| pkg/github/__toolsnaps__/pull_request_read.snap | Captures the expanded read schema. |
| pkg/github/__toolsnaps__/enqueue_pull_request.snap | Records the enqueue tool schema. |
| pkg/github/__toolsnaps__/dequeue_pull_request.snap | Records the dequeue tool schema. |
Review effort: Balanced (adaptive)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds merge queue support to the
pull_requeststoolset: two new tools,enqueue_pull_requestanddequeue_pull_request, plus aget_merge_queue_statusmethod onpull_request_read.Why
On a base branch that requires a merge queue, GitHub rejects the REST merge that
merge_pull_requestuses. Until now an MCP client had to fall back togh pr merge --autoor raw GraphQL to land the pull request. This follows the proposal in the issue, and keeps merge queues separate from auto-merge (#2411).Fixes #3669
What changed
enqueue_pull_request(write) wrapsenqueuePullRequest. It takesowner,repoandpullNumber, plus optionaljump(front of the queue) andexpectedHeadSha(sent asexpectedHeadOid, mirroringmerge_pull_request). It returns the merge queue entry:id,position,state,enqueued_at,estimated_time_to_merge,jumpandsolo.jump: falseis not sent.dequeue_pull_request(write) wrapsdequeuePullRequestand returns the removed entry, ornullwhen GitHub returns none.pull_request_readget_merge_queue_statusreadsisMergeQueueEnabled,isInMergeQueueandmergeQueueEntry. It returns{"merge_queue_enabled": bool, "in_merge_queue": bool, "entry": {...}}, withentryomitted when the pull request isn't queued.nullwhen there is no merge queue. I went with an explicit object instead:merge_queue_enabled: falsetells a client to usemerge_pull_request, whilemerge_queue_enabled: true, in_merge_queue: falsetells it to enqueue. A barenullcan't tell those two apart. Happy to change it if you prefer the other shape.resolvePullRequestNodeID.pullRequestReadOutputSchema, a nullable entry schema for the write tools, and shape-aware field descriptions, including thestateenumQUEUED | AWAITING_CHECKS | MERGEABLE | UNMERGEABLE | LOCKED.pull-request-authoringskill maps both tools as optional. Its decision points now say when to enqueue instead of merging, and that the same confirmation applies.tools.go, with toolsnaps and README regenerated.Not included: the issue's nice-to-have of a clearer
merge_pull_requesterror pointing toenqueue_pull_request. It can be a follow-up.MCP impact
pull_request_readgains theget_merge_queue_statusmethod. The other methods are unchanged.enqueue_pull_requestanddequeue_pull_request.Prompts tested (tool changes only)
{"merge_queue_enabled":true,"in_merge_queue":true,"entry":{"id":"MQE_…","position":1,"state":"AWAITING_CHECKS","enqueued_at":"2026-11-16T19:10:10Z","estimated_time_to_merge":832,"jump":false,"solo":false}}.{"merge_queue_enabled":false,"in_merge_queue":false}.Security / limits
repo, likemerge_pull_request. The status method uses the samePublicRead(repo)scope and IFC labelling as the otherpull_request_readmethods.Tool renaming
deprecated_tool_aliases.goLint & tests
./script/lint: golangci-lint v2.14.0 reports 0 issues, andgofmt -s -l .is clean../script/test:go test ./...passes with Go 1.27.4. New tests are inpullrequests_merge_queue_test.go(mutation inputs, includingjump/expectedHeadOid, GraphQL error paths, a missing pull request, output schemas, the timestamp conversion), plus typed end-to-end cases intyped_consolidated_pull_request_outputs_test.go.Docs
script/generate-docs.Skills
pull-request-authoring(tool mapping and a merge-queue decision point).