Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

create-pull-request-review

Submit code reviews on GitHub pull requests by providing feedback, approving changes, requesting modifications, or adding comments to specific code lines.

Instructions

Create a review on a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesThe body text of the review
commentsNoComments to post as part of the review
commit_idNoThe SHA of the commit that needs a review
eventYesThe review action to perform
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • The handler function that implements the core logic of the 'create-pull-request-review' tool. It validates input using Zod schema, calls the GitHub API to create a review, and returns the review details.
    /** * Create a review on a pull request */ export async function createPullRequestReview(args: unknown): Promise<any> { const { owner, repo, pull_number, body, event, commit_id, comments } = CreatePullRequestReviewSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().pulls.createReview({ owner, repo, pull_number, body, event, commit_id, comments, }); return { id: data.id, user: data.user ? { login: data.user.login, id: data.user.id, } : null, body: data.body, state: data.state, commit_id: data.commit_id, submitted_at: data.submitted_at, url: data.html_url, }; }, 'Failed to create pull request review'); }
  • Zod schema definition for validating the input parameters of the create-pull-request-review tool.
    export const CreatePullRequestReviewSchema = OwnerRepoSchema.extend({ pull_number: z.number().int().positive(), body: z.string().min(1, 'Review body is required'), event: z.enum(['APPROVE', 'REQUEST_CHANGES', 'COMMENT']), commit_id: z.string().optional(), comments: z .array( z.object({ path: z.string().min(1, 'File path is required'), position: z.number().int().positive(), body: z.string().min(1, 'Comment body is required'), }) ) .optional(), });
  • src/server.ts:809-866 (registration)
    Tool registration in the MCP server's listTools handler, providing the tool name, description, and input schema for client discovery.
    { name: 'create-pull-request-review', description: 'Create a review 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', }, commit_id: { type: 'string', description: 'The SHA of the commit that needs a review', }, body: { type: 'string', description: 'The body text of the review', }, event: { type: 'string', enum: ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], description: 'The review action to perform', }, comments: { type: 'array', items: { type: 'object', properties: { path: { type: 'string', description: 'The relative path to the file being commented on', }, position: { type: 'number', description: 'The position in the diff where you want to add a review comment', }, body: { type: 'string', description: 'Text of the review comment', }, }, required: ['path', 'position', 'body'], additionalProperties: false, }, description: 'Comments to post as part of the review', }, }, required: ['owner', 'repo', 'pull_number', 'body', 'event'], additionalProperties: false, },
  • Switch case in the callTool handler that routes execution to the createPullRequestReview function.
    case 'create-pull-request-review': result = await createPullRequestReview(parsedArgs); break;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/piyushgIITian/github-enterprice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server