Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/create-prompt/templates/review-validator-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ Tooling note:

After writing \`${reviewValidatedPath}\`, post comments ONLY for \`status === "approved"\`:

* For each approved entry, call \`github_inline_comment___create_inline_comment\` with the \`comment\` object.
* If there are approved inline comments, call \`github_pr___submit_review\` to submit them — do **NOT** include a \`body\` parameter.
* Collect all approved comments and submit them as a **single batched review** via \`github_pr___submit_review\`, passing them in the \`comments\` array parameter.
* Do **NOT** post comments individually — batch them all into one \`submit_review\` call.
* do **NOT** include a \`body\` parameter in \`submit_review\`.
* Use \`github_comment___update_droid_comment\` to update the tracking comment with the review summary.
* Do **NOT** post the summary as a separate comment or as the body of \`submit_review\`.
* Do not approve or request changes.
Expand Down
47 changes: 41 additions & 6 deletions src/mcp/github-pr-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ export async function listReviewAndIssueComments({
};
}

type ReviewComment = {
path: string;
body: string;
line?: number;
side?: string;
start_line?: number;
start_side?: string;
position?: number;
};

export async function submitReviewWithComments({
owner,
repo,
Expand All @@ -193,7 +203,7 @@ export async function submitReviewWithComments({
repo: string;
prNumber: number;
body?: string;
comments?: Array<{ path: string; position: number; body: string }>;
comments?: ReviewComment[];
octokit: OctokitLike;
}): Promise<number | undefined> {
const response = await octokit.rest.pulls.createReview({
Expand Down Expand Up @@ -603,20 +613,45 @@ export function createGitHubPRServer({

server.tool(
"submit_review",
"Submit a PR review containing inline comments",
"Submit a PR review with all inline comments batched into a single review. " +
"Use line/side to anchor comments to specific lines in the diff.",
{
pr_number: z.number().int().describe("PR number to review"),
body: z.string().describe("Optional summary body").optional(),
comments: z
.array(
z.object({
path: z.string(),
position: z.number().int(),
body: z.string().min(1),
path: z
.string()
.describe("The file path to comment on (e.g., 'src/index.js')"),
body: z.string().min(1).describe("The comment text (supports markdown and GitHub code suggestion blocks)"),
line: z
.number()
.int()
.optional()
.describe(
"Line number for single-line comments, or end line for multi-line comments",
),
side: z
.enum(["LEFT", "RIGHT"])
.optional()
.default("RIGHT")
.describe(
"Side of the diff: RIGHT for new/modified code, LEFT for removed code",
),
start_line: z
.number()
.int()
.optional()
.describe("Start line for multi-line comments"),
start_side: z
.enum(["LEFT", "RIGHT"])
.optional()
.describe("Side for the start line of multi-line comments"),
}),
)
.max(30)
.describe("List of inline comments to include")
.describe("List of inline comments to include in the review")
.optional(),
},
async ({ pr_number, body, comments }) => {
Expand Down
1 change: 0 additions & 1 deletion src/tag/commands/review-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export async function prepareReviewValidatorMode({
"Create",
"Edit",
"github_comment___update_droid_comment",
"github_inline_comment___create_inline_comment",
];

const validatorTools = ["github_pr___submit_review"];
Expand Down