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;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Create a review') but doesn't mention permissions required, whether this is a write operation, rate limits, or what happens when invoked (e.g., notifications sent, review status changes). For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized and front-loaded, immediately conveying the core purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 7 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain behavioral aspects like permissions, side effects, or return values, leaving significant gaps in understanding how to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a review') and target ('on a pull request'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'add-issue-comment' or 'get-pull-request-reviews', which could create confusion about when to use this specific tool versus alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'add-issue-comment' or 'get-pull-request-reviews'. The description doesn't mention prerequisites, appropriate contexts, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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