diff --git a/mcp/README.md b/mcp/README.md index 0d9eefd..af7ceb9 100644 --- a/mcp/README.md +++ b/mcp/README.md @@ -74,6 +74,31 @@ await mcp.call("gh_pullfrog/list_pull_request_reviews", { }); ``` +#### `reply_to_review_comment` +reply to a PR review comment thread explaining how the feedback was addressed. + +**parameters:** +- `pull_number` (number): the pull request number +- `comment_id` (number): the ID of the review comment to reply to +- `body` (string): the reply text explaining how the feedback was addressed + +**replaces:** `gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies` + +**returns:** +the created reply comment including: +- comment id, body, html_url +- in_reply_to_id showing it's a reply to the specified comment + +**example:** +```typescript +// after addressing a review comment +await mcp.call("gh_pullfrog/reply_to_review_comment", { + pull_number: 47, + comment_id: 2567334961, + body: "removed the function as requested" +}); +``` + ### other tools see individual files for documentation on other tools: diff --git a/mcp/comment.ts b/mcp/comment.ts index 70d8618..50db8c0 100644 --- a/mcp/comment.ts +++ b/mcp/comment.ts @@ -168,3 +168,35 @@ export const UpdateWorkingCommentTool = tool({ }; }), }); + +export const ReplyToReviewComment = type({ + pull_number: type.number.describe("the pull request number"), + comment_id: type.number.describe("the ID of the review comment to reply to"), + body: type.string.describe("the reply text explaining how the feedback was addressed"), +}); + +export const ReplyToReviewCommentTool = tool({ + name: "reply_to_review_comment", + description: + "Reply to a PR review comment thread explaining how the feedback was addressed. Use this after addressing each review comment to provide specific context about the changes made.", + parameters: ReplyToReviewComment, + execute: contextualize(async ({ pull_number, comment_id, body }, ctx) => { + const bodyWithFooter = addFooter(body, ctx.payload); + + const result = await ctx.octokit.rest.pulls.createReplyForReviewComment({ + owner: ctx.owner, + repo: ctx.name, + pull_number, + comment_id, + body: bodyWithFooter, + }); + + return { + success: true, + commentId: result.data.id, + url: result.data.html_url, + body: result.data.body, + in_reply_to_id: result.data.in_reply_to_id, + }; + }), +}); diff --git a/mcp/server.ts b/mcp/server.ts index 7fad9c0..93843dd 100644 --- a/mcp/server.ts +++ b/mcp/server.ts @@ -8,6 +8,7 @@ import { CreateCommentTool, CreateWorkingCommentTool, EditCommentTool, + ReplyToReviewCommentTool, UpdateWorkingCommentTool, } from "./comment.ts"; import { DebugShellCommandTool } from "./debug.ts"; @@ -66,6 +67,7 @@ export async function startMcpHttpServer(): Promise<{ url: string; close: () => EditCommentTool, CreateWorkingCommentTool, UpdateWorkingCommentTool, + ReplyToReviewCommentTool, IssueTool, IssueInfoTool, GetIssueCommentsTool, diff --git a/modes.ts b/modes.ts index d2bb1b7..e0661ea 100644 --- a/modes.ts +++ b/modes.ts @@ -33,6 +33,32 @@ export const modes: Mode[] = [ 9. When you are done, create a final commit. If relevant, indicate which issue the PR addresses somewhere in the commit message (e.g. "Fixes #123"). Create a PR with an informative title and body. If relevant, include links to the issue or comment that triggered the PR. 10. Update the Working Comment one final time with a summary of the results. Include links to any created issues/PRs, e.g. \`[View PR](https://github.com/org/repo/pull/123)\` +`, + }, + { + name: "Address Reviews", + description: + "Address PR review feedback; respond to reviewer comments; make requested changes to an existing PR", + prompt: `Follow these steps: +1. ${initialCommentInstruction} + +2. Get PR info with ${ghPullfrogMcpName}/get_pull_request (this automatically fetches and checks out the PR branch) + +3. Review the feedback provided. Understand each review comment and what changes are being requested. + +4. If the request requires understanding the codebase structure, dependencies, or conventions, gather relevant context. Read AGENTS.md if it exists. + +5. Make the necessary code changes to address the feedback. Work through each review comment systematically. + +6. After addressing each review comment, use ${ghPullfrogMcpName}/reply_to_review_comment to reply directly to that comment thread explaining what change was made (keep replies concise, 1-2 sentences). + +7. Test your changes to ensure they work correctly. + +8. Update your working comment using ${ghPullfrogMcpName}/update_working_comment to share overall progress. + +9. When done, commit and push your changes to the existing PR branch. Do not create a new branch or PR - you are updating an existing one. + +10. Update the Working Comment one final time with a summary of all changes made. `, }, {