Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

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
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • 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');
    }
  • 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,
      },
    },
  • Registration of the tool handler in the switch statement for CallToolRequest.
    case 'get-pull-request-reviews':
      result = await getPullRequestReviews(parsedArgs);
      break;
  • Zod schema for input validation used within the handler function.
    export const GetPullRequestReviewsSchema = OwnerRepoSchema.extend({
      pull_number: z.number().int().positive(),
    });

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