create_pull_request_review
Submit a review on a GitHub pull request by specifying the repository owner, repository name, pull request number, review text, and action (approve, request changes, or comment). Includes optional file-specific comments.
Instructions
Create a review on a pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | The body text of the review | |
| comments | No | Comments to post as part of the review | |
| commit_id | No | The SHA of the commit that needs a review | |
| event | Yes | The review action to perform | |
| owner | Yes | Repository owner (username or organization) | |
| pull_number | Yes | Pull request number | |
| repo | Yes | Repository name |
Implementation Reference
- index.ts:515-522 (handler)The handler logic in the main switch statement that parses arguments, calls the createPullRequestReview function, and returns the result.case "create_pull_request_review": { const args = pulls.CreatePullRequestReviewSchema.parse(request.params.arguments); const { owner, repo, pull_number, ...options } = args; const review = await pulls.createPullRequestReview(owner, repo, pull_number, options); return { content: [{ type: "text", text: JSON.stringify(review, null, 2) }], }; }
- operations/pulls.ts:108-120 (schema)Zod schema defining the input parameters for the create_pull_request_review tool.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") });
- index.ts:166-169 (registration)Tool registration in the list of available tools, including name, description, and input schema reference.name: "create_pull_request_review", description: "Create a review on a pull request", inputSchema: zodToJsonSchema(pulls.CreatePullRequestReviewSchema) },
- operations/pulls.ts:209-223 (helper)The core helper function that makes the GitHub API request to create the pull request review.export async function createPullRequestReview( 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( `https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`, { method: 'POST', body: options, } ); return PullRequestReviewSchema.parse(response); }