create_pull_request_review
Submit a review on a GitHub pull request to approve changes, request modifications, or add comments for code collaboration.
Instructions
Create a review on a pull request (approve, request changes, or comment)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pullNumber | Yes | ||
| body | No | ||
| event | Yes | ||
| comments | No |
Implementation Reference
- Core handler implementation that executes the GitHub API call to create a pull request review using Octokitasync createPullRequestReview(data: { pullNumber: number; body?: string; event: 'APPROVE' | 'REQUEST_CHANGES' | 'COMMENT'; comments?: Array<{ path: string; position?: number; body: string; }>; }): Promise<{ id: number; user: string; state: string; body: string }> { try { const octokit = this.factory.getOctokit(); const config = this.factory.getConfig(); const response = await octokit.rest.pulls.createReview({ owner: config.owner, repo: config.repo, pull_number: data.pullNumber, body: data.body, event: data.event, comments: data.comments }); return { id: response.data.id, user: response.data.user?.login || 'unknown', state: response.data.state, body: response.data.body || '' }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- Tool definition including Zod input schema, description, and usage examples for validationexport const createPullRequestReviewTool: ToolDefinition<CreatePullRequestReviewArgs> = { name: "create_pull_request_review", description: "Create a review on a pull request (approve, request changes, or comment)", schema: createPullRequestReviewSchema as unknown as ToolSchema<CreatePullRequestReviewArgs>, examples: [ { name: "Approve PR", description: "Approve a pull request", args: { pullNumber: 42, event: "APPROVE", body: "LGTM! Great work on the authentication implementation." } }, { name: "Request changes", description: "Request changes with inline comments", args: { pullNumber: 42, event: "REQUEST_CHANGES", body: "Please address the comments below", comments: [ { path: "src/auth.ts", position: 15, body: "Consider using bcrypt for password hashing" } ] } } ] };
- src/infrastructure/tools/ToolRegistry.ts:231-231 (registration)Registers the create_pull_request_review tool in the central ToolRegistrythis.registerTool(createPullRequestReviewTool);
- src/index.ts:361-362 (handler)Main tool dispatch handler that routes tool calls to the service implementationcase "create_pull_request_review": return await this.service.createPullRequestReview(args);