create_pull_request_review
Submit detailed reviews on GitHub pull requests, including feedback, comments, and approval status, to ensure code quality and collaboration within repositories.
Instructions
Create a review for 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
- src/operations/pulls.ts:257-273 (handler)The core handler function that performs the GitHub API POST request 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 defining parameters for creating a pull request review, used in tool registration and validation.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/index.ts:196-198 (registration)Tool registration in the listTools handler, defining 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)Dispatcher case in the main CallToolRequest handler that parses arguments and delegates to the pulls.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) }], }; }
- src/operations/pulls.ts:126-128 (schema)Extended schema including the GitHub PAT, used for internal parsing in the dispatcher.export const _CreatePullRequestReviewSchema = CreatePullRequestReviewSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });