get-pull-request-reviews
Retrieve all reviews for a specific GitHub pull request to track feedback, approvals, and changes requested during code review.
Instructions
Get the reviews on a pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| pull_number | Yes | Pull request number | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/pull-requests.ts:395-419 (handler)The handler function that executes the tool logic: parses input using Zod schema, calls GitHub API to list reviews for the specified pull request, maps the response, and handles errors.export async function getPullRequestReviews(args: unknown): Promise<any> { const { owner, repo, pull_number } = GetPullRequestReviewsSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().pulls.listReviews({ owner, repo, pull_number, }); return data.map((review) => ({ id: review.id, user: review.user ? { login: review.user.login, id: review.user.id, } : null, body: review.body, state: review.state, commit_id: review.commit_id, submitted_at: review.submitted_at, url: review.html_url, })); }, 'Failed to get pull request reviews'); }
- src/server.ts:1000-1022 (schema)MCP tool schema definition including input schema for the 'get-pull-request-reviews' tool, registered in the listTools response.{ name: 'get-pull-request-reviews', description: 'Get the reviews on a pull request', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner (username or organization)', }, repo: { type: 'string', description: 'Repository name', }, pull_number: { type: 'number', description: 'Pull request number', }, }, required: ['owner', 'repo', 'pull_number'], additionalProperties: false, }, },
- src/server.ts:1250-1252 (registration)Registration of the tool handler in the switch statement for CallToolRequest.case 'get-pull-request-reviews': result = await getPullRequestReviews(parsedArgs); break;
- src/utils/validation.ts:178-180 (schema)Zod schema for input validation used within the handler function.export const GetPullRequestReviewsSchema = OwnerRepoSchema.extend({ pull_number: z.number().int().positive(), });