Skip to content

Add tools for one-off PR comments and replying to PR review comments #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 12, 2025

Conversation

ashwin-ant
Copy link
Contributor

  • Added two new tools for working with pull request review comments:
    • add_pull_request_review_comment: Create line, multi-line, or file-level review comments (not attached to a PR review). Corresponds to this endpoint.
    • reply_to_pull_request_review_comment: Reply to existing PR review comments. Corresponds to this endpoint.
  • Verified functionality manually in MCP Insector

ashwin-ant and others added 3 commits April 8, 2025 07:41
Adds the ability to add review comments to pull requests with support for line, multi-line, and file-level comments, as well as replying to existing comments.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Adds a new tool to reply to existing pull request review comments using the GitHub API's comment reply endpoint. This allows for threaded discussions on pull request reviews.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ashwin-ant
Copy link
Contributor Author

@juruen mind taking a look? Would love to get this in if possible 😄

@ashwin-ant ashwin-ant force-pushed the prcomments branch 2 times, most recently from 104ba61 to 84e6f6a Compare April 9, 2025 01:28
@juruen
Copy link
Collaborator

juruen commented Apr 11, 2025

I manually tested this and things worked as expected.

Screenshot 2025-04-11 at 11 02 35

I'd say we are good to merge!

Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@juruen
Copy link
Collaborator

juruen commented Apr 11, 2025

@ashwin-ant although what we have now seems to work, there's something else I'd like to explore here: the possibility of using a single tool for both cases, as add_pull_request_review_comment also supports getting an in_reply_to.

I've tried to reply to a comment with that tool and hasn't worked, so I'd like us to spend a bit of time on it to try to figure that out.

Thanks!

Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, see my comment about trying to use a single tool for both use cases.

Thanks!

ashwin-ant and others added 2 commits April 11, 2025 08:11
The separate AddPullRequestReviewComment and ReplyToPullRequestReviewComment tools have been merged into a single tool that handles both creating new comments and replying to existing ones. This approach simplifies the API and provides a more consistent interface for users.

- Made commit_id and path optional when using in_reply_to for replies
- Updated the tests to verify both comment and reply functionality
- Removed the separate ReplyToPullRequestReviewComment tool
- Fixed test expectations to match how errors are returned

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ashwin-ant
Copy link
Contributor Author

@juruen Updated to only have a single tool. Turns out the add_pull_request_review_comment tool was failing when used with in_reply_to due to a subtlety in the underlying go-github library, but there was a way to work around it.

@ashwin-ant ashwin-ant requested a review from juruen April 11, 2025 15:20
@juruen
Copy link
Collaborator

juruen commented Apr 12, 2025

@juruen Updated to only have a single tool. Turns out the add_pull_request_review_comment tool was failing when used with in_reply_to due to a subtlety in the underlying go-github library, but there was a way to work around it.

Thank you, so much! I've manually tested the latest version and works perfectly for both cases!

@juruen juruen merged commit 6c05b40 into github:main Apr 12, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants