Skip to main content
Glama

create_pull_request_review

Submit a review on a GitHub pull request by specifying the repository owner, repository name, pull request number, review text, and action (approve, request changes, or comment). Includes optional file-specific comments.

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 logic in the main switch statement that parses arguments, calls the createPullRequestReview function, and returns the result.
    case "create_pull_request_review": {
      const args = pulls.CreatePullRequestReviewSchema.parse(request.params.arguments);
      const { owner, repo, pull_number, ...options } = args;
      const review = await pulls.createPullRequestReview(owner, repo, pull_number, options);
      return {
        content: [{ type: "text", text: JSON.stringify(review, null, 2) }],
      };
    }
  • Zod schema defining the input parameters for the create_pull_request_review tool.
    export const CreatePullRequestReviewSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      pull_number: z.number().describe("Pull request number"),
      commit_id: z.string().optional().describe("The SHA of the commit that needs a review"),
      body: z.string().describe("The body text of the review"),
      event: z.enum(['APPROVE', 'REQUEST_CHANGES', 'COMMENT']).describe("The review action to perform"),
      comments: z.array(z.object({
        path: z.string().describe("The relative path to the file being commented on"),
        position: z.number().describe("The position in the diff where you want to add a review comment"),
        body: z.string().describe("Text of the review comment")
      })).optional().describe("Comments to post as part of the review")
    });
  • index.ts:166-169 (registration)
    Tool registration in the list of available tools, including name, description, and input schema reference.
      name: "create_pull_request_review",
      description: "Create a review on a pull request",
      inputSchema: zodToJsonSchema(pulls.CreatePullRequestReviewSchema)
    },
  • The core helper function that makes the GitHub API request to create the pull request review.
    export async function createPullRequestReview(
      owner: string,
      repo: string,
      pullNumber: number,
      options: Omit<z.infer<typeof CreatePullRequestReviewSchema>, 'owner' | 'repo' | 'pull_number'>
    ): Promise<z.infer<typeof PullRequestReviewSchema>> {
      const response = await githubRequest(
        `https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`,
        {
          method: 'POST',
          body: options,
        }
      );
      return PullRequestReviewSchema.parse(response);
    }

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/tuanle96/mcp-github'

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