[Reply To Review Comments] Add reply_to_review_comment tool for threaded PR review responses
Add reply_to_review_comment Tool
Summary
This PR adds a new MCP tool reply_to_review_comment that enables AI agents to reply directly to individual pull request review comment threads. This maintains conversation context at specific code locations, allowing agents to participate in threaded code review discussions just as human developers do.
Problem: Previously, AI agents could only post general PR comments, which separated responses from the code they referenced and made review conversations fragmented.
Solution: The new tool provides direct access to GitHub's review comment reply API, allowing agents to respond within existing comment threads at specific code locations.
Related Issue
Closes https://github.com/github/github-mcp-server/issues/1323
Implementation Details
Core Changes
New Tool: reply_to_review_comment in pkg/github/pullrequests.go
- Uses GitHub REST API:
POST /repos/{owner}/{repo}/pulls/{pull_number}/comments - Calls
client.PullRequests.CreateCommentInReplyTo()from go-github v79 - Parameters:
owner,repo,pull_number,comment_id,body - Returns
MinimalResponsewith reply ID and URL
Toolset Registration: Added to repository_management toolset as a write tool
Testing: Comprehensive unit tests with 10 test cases covering:
- Successful reply creation (HTTP 201)
- Error scenarios (404, 403, 422)
- Parameter validation
- Mock HTTP client for REST API testing
Technical Decisions
- REST API over GraphQL: go-github provides a clean
CreateCommentInReplyTomethod - Required pull_number: GitHub API requires PR number in the endpoint path
- int64 comment IDs: Uses
RequiredBigIntvalidation for proper type handling - Single-reply operations: Agents orchestrate batch operations by calling the tool multiple times
- Minimal response format: Returns only ID and URL, consistent with other create/update tools
Testing
Manual Testing Performed
Tested the tool in VS Code with the GitHub MCP Server:
- Created a test PR with review comments
- Retrieved comment IDs using
pull_request_readwithget_review_commentsmethod - Used
reply_to_review_commentto respond to review comments - Verified replies appeared as threaded responses in GitHub UI at correct code locations
- Confirmed notifications were sent to reviewers
Result: Tool works as expected - replies appear correctly threaded in the GitHub UI.
Automated Tests
- All unit tests pass (
script/test) - Linting passes with 0 issues (
script/lint) - Toolsnap validation confirms schema stability
- Documentation generated successfully
Documentation
- README.md updated with tool documentation (auto-generated via
script/generate-docs) - Tool parameters clearly documented with types and descriptions
- Error handling documented for common failure scenarios
Project Artifacts
This implementation followed a structured development process. Supporting documentation is available in my fork:
Example Usage
{
"owner": "myorg",
"repo": "myproject",
"pull_number": 42,
"comment_id": 12345,
"body": "Good point! I've renamed the variable to `userSessionManager` in commit abc123."
}
Response:
{
"id": "67890",
"url": "https://github.com/myorg/myproject/pull/42#discussion_r67890"
}
Breaking Changes
None - this is a new tool addition that doesn't affect existing tools or APIs.
🐾 Generated with PAW