feat: add get_reviewers and get_status_checks to pull_request_read#2639
Open
salakonrad wants to merge 1 commit into
Open
feat: add get_reviewers and get_status_checks to pull_request_read#2639salakonrad wants to merge 1 commit into
salakonrad wants to merge 1 commit into
Conversation
…_read Extends the pull_request_read tool with two new methods: - get_reviewers: returns pending reviewer requests (both individual users and teams) using the PullRequests.ListReviewers API. This fills a gap in the existing toolset — requested team reviewers were previously not exposed anywhere in the MCP server. - get_status_checks: returns a unified view of all status checks for a PR's head commit by combining legacy commit statuses (e.g. Atlantis plan/policy results) and modern GitHub Actions check runs into a single response with a top-level combined_state. New output types added to minimal_types.go: - MinimalReviewerUser, MinimalReviewerTeam, MinimalPRReviewers - MinimalCommitStatus, MinimalStatusChecks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds new pull request tool methods to retrieve requested reviewers and a unified status-checks view (commit statuses + check runs), with accompanying minimal response types.
Changes:
- Extend pull request tool method enum + dispatcher to support
get_reviewersandget_status_checks. - Implement
GetPullRequestReviewersandGetPullRequestStatusChecksin the GitHub PR tool. - Add minimal JSON output types for reviewers and combined status/check data.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| pkg/github/pullrequests.go | Adds tool methods and implementations for requested reviewers and unified status checks. |
| pkg/github/minimal_types.go | Introduces minimal response structs for reviewers and combined status/checks output. |
| if err != nil { | ||
| return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get pull request", resp, err), nil | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
| if err != nil { | ||
| return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get combined status", resp, err), nil | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
| if err != nil { | ||
| return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get check runs", resp, err), nil | ||
| } | ||
| defer func() { _ = resp.Body.Close() }() |
|
|
||
| sha := pr.GetHead().GetSHA() | ||
|
|
||
| combinedStatus, resp, err := client.Repositories.GetCombinedStatus(ctx, owner, repo, sha, nil) |
| return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get combined status", resp, body), nil | ||
| } | ||
|
|
||
| checkRuns, resp, err := client.Checks.ListCheckRunsForRef(ctx, owner, repo, sha, nil) |
Comment on lines
+395
to
+401
| if resp.StatusCode != http.StatusOK { | ||
| body, err := io.ReadAll(resp.Body) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to read response body: %w", err) | ||
| } | ||
| return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get pull request", resp, body), nil | ||
| } |
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
This PR extends the
pull_request_readtool with two new methods that address gaps in the current PR toolset:get_reviewers— returns the list of pending reviewer requests for a pull request, including both individual users and team reviewers. Previously, thegetmethod only exposed requested user reviewers (as a flat list of logins) and team reviewers were entirely invisible in the MCP server. This uses thePullRequests.ListReviewersREST endpoint.get_status_checks— returns a unified view of all status checks for the PR's head commit by combining:plan/policy_check, external CI tools) viaRepositories.GetCombinedStatusChecks.ListCheckRunsForRefThe response includes a top-level
combined_stateand atotal_countacross both sources. Previously these required two separate calls (get_statusandget_check_runs) with no unified view.New types (
minimal_types.go)MinimalReviewerUserMinimalReviewerTeamMinimalPRReviewersget_reviewersMinimalCommitStatusMinimalStatusChecksTest plan
get_reviewersreturns correct users and teams for a PR with review requestsget_reviewersreturns empty arrays for a PR with no pending reviewersget_status_checksreturns both legacy statuses and check runs for a PRget_status_checkscombined_statereflects the overall GitHub statusget,get_reviews,get_check_runs, etc.) unaffectedgo build ./pkg/github/...🤖 Generated with Claude Code