github-mcp-server icon indicating copy to clipboard operation
github-mcp-server copied to clipboard

feat: add `list_pull_request_review_threads` tool to expose PRRT_ node IDs for resolving threads

Open scottlz0310-user opened this issue 8 months ago • 12 comments

Problem

resolve_pull_request_review_thread requires a thread node ID in PRRT_xxx format. However, this ID is not returned by any existing REST-based MCP tool — it is only obtainable via the GraphQL API.

Currently there is no way to complete the "list unresolved threads → resolve them" flow using the MCP tools alone, because there is no tool to retrieve the PRRT_xxx node IDs needed by resolve_pull_request_review_thread.

Proposed Solution

Add a list_pull_request_review_threads tool that uses the existing githubv4 GraphQL client (already a dependency) to query review threads and return their node IDs.

Tool Definition

Name: list_pull_request_review_threads

Input:

Parameter Type Required Description
owner string ✅ Repository owner
repo string ✅ Repository name
pull_number integer ✅ Pull request number
is_resolved boolean ❌ Filter by resolution status. Omit to return all threads.

Output (per thread):

Field Type Description
id string Node ID in PRRT_xxx format — required for resolve_pull_request_review_thread
isResolved boolean Whether the thread has been resolved
isOutdated boolean Whether the thread is outdated (code changed after the comment)
path string File path the thread is on
line integer End line number
startLine integer Start line number
firstComment.body string Body of the first comment in the thread
firstComment.author string Login of the commenter
firstComment.createdAt string ISO 8601 timestamp

Response envelope:

{
  "threads": [...],
  "totalCount": 4,
  "truncated": false
}

Suggested GraphQL Query

query($owner: String!, $repo: String!, $number: Int!) {
  repository(owner: $owner, name: $repo) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        totalCount
        nodes {
          id
          isResolved
          isOutdated
          path
          line
          startLine
          comments(first: 1) {
            nodes {
              body
              author { login }
              createdAt
            }
          }
        }
      }
    }
  }
}

Registration

Would fit naturally in AllTools() in pkg/github/tools.go, alongside the existing resolve_pull_request_review_thread tool in ToolsetMetadataPullRequests.

Use Case / Motivation

The intended workflow is:

list_pull_request_review_threads(owner, repo, pull_number, is_resolved=false)
  → returns [{ id: "PRRT_kwDO...", ... }, ...]

resolve_pull_request_review_thread(threadId: "PRRT_kwDO...")
  → marks thread as resolved

Without list_pull_request_review_threads, an AI agent has no way to obtain the PRRT_xxx ID, making resolve_pull_request_review_thread effectively unusable from an MCP context.

Validation

We implemented this tool as a local patch against the current main branch and validated the end-to-end flow:

  • Tool appears in the MCP tool list ✅
  • Returns PRRT_xxx node IDs correctly ✅
  • is_resolved=false filter works as expected ✅
  • Returned IDs successfully used with resolve_pull_request_review_thread to resolve all 4 unresolved threads in a live PR ✅

The patch implementation is available at:
https://github.com/scottlz0310/Mcp-Docker/blob/main/patches/github/list_pr_review_threads.go

Additional Notes

  • No new dependencies required — uses the existing github.com/shurcooL/githubv4 client
  • is_resolved uses a 3-value pattern (nil = all, true = resolved only, false = unresolved only) consistent with similar optional boolean filters in the codebase
  • Type names chosen to avoid collision with existing reviewThreadsQuery / reviewThreadNode types in pullrequests.go

Happy to submit a PR if this direction looks good to the maintainers.

scottlz0310-user avatar Mar 17 '26 12:03 scottlz0310-user

Closing this issue as we've since taken a different approach.

We've implemented list_pull_request_review_threads (along with get_copilot_review_status and related tools) as a standalone MCP service in a separate repository: https://github.com/scottlz0310/copilot-review-mcp

This service runs alongside the official github-mcp-server and provides the full PR review thread workflow without requiring changes to the upstream server. This approach gives us the flexibility to iterate independently.

Thank you to everyone who reacted to this issue — the problem (PRRT_ node IDs not being accessible via MCP tools) remains valid, and if the upstream maintainers ever want to address it natively, the implementation details in this issue may still be useful reference.

Withdrawing the request.

scottlz0310-user avatar Apr 27 '26 06:04 scottlz0310-user

@scottlz0310-user we may yet get to n this, you're welcome to leave open even though it's resolved for you yourself with additional server.

We haven't ruled it out, there's just a lot of things we are responsible for, use-cases and problems like this are really helpful.

SamMorrowDrums avatar Apr 27 '26 11:04 SamMorrowDrums

I also vote to leave it open or make a duplicate :) Still need this

MitchTalmadge avatar Apr 27 '26 15:04 MitchTalmadge

@SamMorrowDrums Happy to reopen! The standalone copilot-review-mcp works well for our use case, but native support in github-mcp-server would definitely benefit more users (as MitchTalmadge's comment confirms). Leaving it open for upstream consideration.

scottlz0310-user avatar Apr 27 '26 15:04 scottlz0310-user

[!Note] Responses generated with Claude

It looks like this may already be resolved by existing tools:

  • pull_request_read with method get_review_comments returns threads with metadata including thread IDs
  • pull_request_review_write with method resolve_thread accepts threadId (PRRT_ node ID)

The pull_request_review_write tool description itself says: "Get thread IDs from pull_request_read with method get_review_comments."

This suggests the end-to-end flow described in this issue (list unresolved threads → get PRRT_ IDs → resolve them) is now possible without a separate list_pull_request_review_threads tool. Could this be closed?

kaovilai avatar Apr 30 '26 21:04 kaovilai

@kaovilai This issue will be resolved by #2245, which restores the id field to MinimalReviewThread in get_review_comments.

Note for #issuecomment-4356412600: the end-to-end flow is NOT yet possible — #2245 is still open and unmerged. The id field is absent from the current shipped response, as confirmed by hands-on testing (which is why copilot-review-mcp exists).

Supporting #2245. 👍

scottlz0310-user avatar Apr 30 '26 22:04 scottlz0310-user

ic thx.

kaovilai avatar Apr 30 '26 22:04 kaovilai

yes I was about to log an issue for this very sisue

get_review_comments does not return thread node IDs required by resolve_thread

Summary

The pull_request_read tool with method: get_review_comments documents that it returns thread IDs for use with resolve_thread, but the actual response omits the thread node ID (PRRT_kwDO... format) from each thread object. This makes resolve_thread unusable without a separate GraphQL call outside the MCP toolset.

Expected behaviour

Each thread object returned by get_review_comments should include a id (or node_id) field containing the thread's GraphQL node ID (e.g. PRRT_kwDOKv9N8c6AQpXZ), consistent with the tool description which states:

Get thread IDs from pull_request_read with method get_review_comments.

Actual behaviour

The response contains review_threads objects with only:

{
  "is_resolved": false,
  "is_outdated": false,
  "is_collapsed": false,
  "comments": [ ... ],
  "total_count": 2
}

There is no id or node_id on the thread itself. Individual comments have an html_url like https://github.com/.../pull/429#discussion_r3194795661, but the discussion_r... value is the comment ID, not the thread node ID required by resolve_thread.

Attempting to use resolve_thread with a guessed PRRT_... ID returns:

failed to resolve review thread: Could not resolve to a node with the global id of 'PRRT_...'

Impact

resolve_thread and unresolve_thread are completely unusable through the MCP toolset alone. Workarounds require either:

  • A separate gh api graphql call outside the MCP (requires gh CLI), or
  • Browser automation to click "Resolve conversation" buttons manually.

Steps to reproduce

  1. Call pull_request_read with method: get_review_comments on any PR that has open review threads.
  2. Observe that no thread node ID is present in the response.
  3. Attempt to call pull_request_review_write with method: resolve_thread — there is no valid threadId to supply.

Suggested fix

Add a id field (the GraphQL node_id, e.g. PRRT_kwDO...) to each thread object in the get_review_comments response. This field is available on PullRequestReviewThread.id in GitHub's GraphQL schema and is already used internally to power resolve_thread.

Environment

  • Tool: pull_request_read / pull_request_review_write
  • MCP server: github-mcp-server (github-insiders variant)
  • Tested on: PR with 3 Copilot review threads, all unresolved

aarondglover avatar May 06 '26 14:05 aarondglover

@aarondglover Thank you for the detailed report — this is exactly what #2229 tracks.

The fix is proposed in #2245, which restores the id field to each thread object in get_review_comments. Until that's merged, copilot-review-mcp is available as a tandalone workaround that exposes the full thread-resolve workflow independently.

scottlz0310-user avatar May 07 '26 02:05 scottlz0310-user

Triage note: tracking this with #2245 for now. If that PR lands, it should restore the thread IDs needed for the get_review_comments -> resolve_thread flow without adding a separate listing tool.

SamMorrowDrums avatar May 08 '26 13:05 SamMorrowDrums

Update: the core issue has been fixed on main by #2245.

#2245 restores the review thread id field in the existing get_review_comments response, which enables the MCP-only workflow:

get_review_comments → obtain thread id → resolve_thread / unresolve_thread

This is a cleaner upstream fix than the new list_pull_request_review_threads tool proposed here.

I'll keep this issue open until the fix is included in a tagged release, since the latest release (v1.1.2) does not appear to include #2245 yet. Once a release containing #2245 is available, this issue can be closed as resolved.

scottlz0310-user avatar Jun 02 '26 05:06 scottlz0310-user

resolved by #2515 / also addressed by #2245

scottlz0310-user avatar Jun 07 '26 23:06 scottlz0310-user