create_pull_request_review
Submit code review feedback on GitHub pull requests by approving changes, requesting modifications, or adding comments to specific lines.
Instructions
Create a review for a pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| pull_number | Yes | Pull request number | |
| commit_id | No | The SHA of the commit that needs a review | |
| body | Yes | The body text of the review | |
| event | Yes | The review action to perform | |
| comments | No | Comments to post as part of the review |
Implementation Reference
- src/operations/pulls.ts:257-273 (handler)Core handler function that executes the GitHub API call to create a pull request review.export async function createPullRequestReview( github_pat: string, owner: string, repo: string, pullNumber: number, options: Omit<z.infer<typeof CreatePullRequestReviewSchema>, 'owner' | 'repo' | 'pull_number'> ): Promise<z.infer<typeof PullRequestReviewSchema>> { const response = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`, { method: 'POST', body: options, } ); return PullRequestReviewSchema.parse(response); }
- src/operations/pulls.ts:112-124 (schema)Input schema definition for the create_pull_request_review tool parameters.export const CreatePullRequestReviewSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), pull_number: z.number().describe("Pull request number"), commit_id: z.string().optional().describe("The SHA of the commit that needs a review"), body: z.string().describe("The body text of the review"), event: z.enum(['APPROVE', 'REQUEST_CHANGES', 'COMMENT']).describe("The review action to perform"), comments: z.array(z.object({ path: z.string().describe("The relative path to the file being commented on"), position: z.number().describe("The position in the diff where you want to add a review comment"), body: z.string().describe("Text of the review comment") })).optional().describe("Comments to post as part of the review") });
- src/operations/pulls.ts:126-128 (schema)Extended schema including GitHub PAT, used for argument parsing in the tool handler.export const _CreatePullRequestReviewSchema = CreatePullRequestReviewSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:195-199 (registration)Tool registration in the list of available tools, specifying name, description, and input schema.{ name: "create_pull_request_review", description: "Create a review for a pull request", inputSchema: zodToJsonSchema(pulls.CreatePullRequestReviewSchema), },
- src/index.ts:588-595 (handler)MCP server dispatch handler case that parses arguments and calls the core createPullRequestReview function.case "create_pull_request_review": { const args = pulls._CreatePullRequestReviewSchema.parse(params.arguments); const { github_pat, owner, repo, pull_number, ...options } = args; const result = await pulls.createPullRequestReview(github_pat, owner, repo, pull_number, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }