Add updating draft state to update_pull_request tool#774
Merged
mattdholloway merged 6 commits intomainfrom Jul 29, 2025
Merged
Conversation
This was referenced Jul 28, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds draft state management functionality to the update_pull_request tool, allowing users to mark pull requests as drafts or ready for review through GraphQL mutations.
- Adds a new
draftboolean parameter to theupdate_pull_requesttool - Implements GraphQL-based draft state mutations (
convertPullRequestToDraftandmarkPullRequestReadyForReview) - Updates the tool to handle both REST API updates for traditional fields and GraphQL mutations for draft state changes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Updates function signature to include GraphQL client parameter |
| pkg/github/pullrequests.go | Adds draft parameter handling and GraphQL mutation logic for draft state changes |
| pkg/github/pullrequests_test.go | Adds comprehensive test coverage for draft functionality with mock GraphQL clients |
| pkg/github/toolsnaps/update_pull_request.snap | Updates tool schema snapshot to include new draft parameter |
| README.md | Documents the new draft parameter in the tool usage section |
Comments suppressed due to low confidence (1)
pkg/github/pullrequests.go:456
- The comment is misleading - it says 'Current state is draft' but the value is false, indicating it's not a draft. The comment should be corrected to reflect the actual state.
mcp.Enum("asc", "desc"),
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get GitHub client: %w", err) | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
The REST client is retrieved twice in this function (lines 311 and 400). Consider retrieving it once at the beginning and reusing it to improve efficiency and reduce duplication.
Suggested change
| } | |
| // Reuse the client retrieved earlier |
almaleksia
approved these changes
Jul 29, 2025
MayorFaj
pushed a commit
to MayorFaj/github-mcp-server
that referenced
this pull request
Jul 29, 2025
* initial impl of pull request draft state update * appease linter * update README * add nosec * fixed err return type for json marshalling * add gql test
mattdholloway
added a commit
that referenced
this pull request
Jul 31, 2025
* feat: add reviewers parameter to UpdatePullRequest and update tests * Update pullrequests.go * feat: enhance update pull request functionality with reviewers support * update README to clarify optional reviewers parameter in API documentation- go run ./cmd/github-mcp-server generate-docs * feat: enhance UpdatePullRequest to return early if no updates or reviewers are provided * Add updating draft state to `update_pull_request` tool (#774) * initial impl of pull request draft state update * appease linter * update README * add nosec * fixed err return type for json marshalling * add gql test * Add support for org-level discussions in list_discussions tool (#775) * make repo optional, and default to .github when not provided. improve tool description * autogen * update tests * small copy paste error fixes * refactor: streamline UpdatePullRequest logic and enhance test cases for reviewer updates * refactor: remove redundant draft update tests and streamline UpdatePullRequest logic * test: add unit tests for updating pull request draft state * refactor: simplify UpdatePullRequest tests by removing unused mock data --------- Co-authored-by: Matt Holloway <mattdholloway@github.com> Co-authored-by: Tommaso Moro <37270480+tommaso-moro@users.noreply.github.com>
Arturo171
approved these changes
Aug 6, 2025
Gowza68
approved these changes
Aug 6, 2025
This comment was marked as spam.
This comment was marked as spam.
Gowza68
approved these changes
Aug 6, 2025
nickytonline
pushed a commit
to nickytonline/github-mcp-http
that referenced
this pull request
Oct 4, 2025
* initial impl of pull request draft state update * appease linter * update README * add nosec * fixed err return type for json marshalling * add gql test
nickytonline
pushed a commit
to nickytonline/github-mcp-http
that referenced
this pull request
Oct 4, 2025
* feat: add reviewers parameter to UpdatePullRequest and update tests * Update pullrequests.go * feat: enhance update pull request functionality with reviewers support * update README to clarify optional reviewers parameter in API documentation- go run ./cmd/github-mcp-server generate-docs * feat: enhance UpdatePullRequest to return early if no updates or reviewers are provided * Add updating draft state to `update_pull_request` tool (github#774) * initial impl of pull request draft state update * appease linter * update README * add nosec * fixed err return type for json marshalling * add gql test * Add support for org-level discussions in list_discussions tool (github#775) * make repo optional, and default to .github when not provided. improve tool description * autogen * update tests * small copy paste error fixes * refactor: streamline UpdatePullRequest logic and enhance test cases for reviewer updates * refactor: remove redundant draft update tests and streamline UpdatePullRequest logic * test: add unit tests for updating pull request draft state * refactor: simplify UpdatePullRequest tests by removing unused mock data --------- Co-authored-by: Matt Holloway <mattdholloway@github.com> Co-authored-by: Tommaso Moro <37270480+tommaso-moro@users.noreply.github.com>
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.
Closes: #501 and #423
This is a copy of the comment in issue 501:
I've had a look at implementing this as an extension of the
update_pull_requesttool (using GraphQL). I've chosen to use a newdraftparameter as a boolean for this for a few reasons: