VX Agents

OpenAPI Marketplace · Developer Tools

GitHub Pull Requests & Code Review

v1.0.0 · 15 endpoints · 0 connections · shared by vx.ai

Lets an agent review pull requests on GitHub: read the PR, its changed files with per-file diffs, commits and existing discussion, then post a single review with inline comments. It can also open and update pull requests, request reviewers and merge once a person approves. Curated from GitHub's official OpenAPI specification.

Connect this API to an AI agent Browse all specs

What you can do with GitHub Pull Requests & Code Review via MCP

Every endpoint below becomes a governed tool your AI agent (Claude, ChatGPT, or a customer-facing VX agent) can call — with scoped permissions, sandbox testing, and audit logs.

MethodPathOperationDescription
GET /repos/{owner}/{repo}/pulls listPullRequests List pull requests in a repository (filter by state, head, base)
POST /repos/{owner}/{repo}/pulls createPullRequest Open a new pull request from one branch into another
GET /repos/{owner}/{repo}/pulls/{pull_number} getPullRequest Get one pull request with its title, description, branches and head SHA
PATCH /repos/{owner}/{repo}/pulls/{pull_number} updatePullRequest Change a pull request's title, description, base branch or state
GET /repos/{owner}/{repo}/pulls/{pull_number}/files listPullRequestFiles List the files changed in a pull request with each file's diff (patch)
GET /repos/{owner}/{repo}/pulls/{pull_number}/commits listPullRequestCommits List the commits in a pull request
GET /repos/{owner}/{repo}/compare/{basehead} compareCommits Compare two branches or commits and see the changed files
GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews listPullRequestReviews List the reviews already submitted on a pull request
POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews createPullRequestReview Submit a review (comment, approve or request changes) with inline comments
GET /repos/{owner}/{repo}/pulls/{pull_number}/comments listPullRequestReviewComments List inline review comments on a pull request's code
POST /repos/{owner}/{repo}/pulls/{pull_number}/comments createPullRequestReviewComment Add a single inline comment on a line of a pull request's diff
GET /repos/{owner}/{repo}/issues/{issue_number}/comments listIssueComments List conversation comments on a pull request (use the PR number)
POST /repos/{owner}/{repo}/issues/{issue_number}/comments createIssueComment Post a general comment in a pull request's conversation
POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers requestPullRequestReviewers Ask people or teams to review a pull request
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge mergePullRequest Merge a pull request (only after the user confirms)

Authentication

githubToken

Bearer token — sent as Authorization: Bearer <token>

GitHub fine-grained personal access token (or a GitHub App installation token) sent as Authorization: Bearer <token>.

How to get a credential

  1. In GitHub open Settings > Developer settings > Personal access tokens > Fine-grained tokens and click Generate new token.
  2. Pick the resource owner (your user or organization) and set an expiry.
  3. Under Repository access choose Only select repositories and pick the repositories the agent may review.
  4. Under Repository permissions set Pull requests: Read and write, Contents: Read-only, Issues: Read and write (Metadata: Read-only is added automatically).
  5. Generate the token and copy it (it starts with github_pat_). Organization-owned repositories may need an owner to approve the token.

Permissions used

Permission Operations
Metadata: read all read calls on the repository
Pull requests: read listPullRequests, getPullRequest, listPullRequestFiles, listPullRequestCommits, listPullRequestReviews, listPullRequestReviewComments
Contents: read compareCommits, listPullRequestFiles
Pull requests: write createPullRequestReview, createPullRequestReviewComment, createPullRequest, updatePullRequest, requestPullRequestReviewers
Contents: write + Pull requests: write mergePullRequest
Issues: read / write listIssueComments / createIssueComment (PR conversation comments)

Common errors

  • 401 Bad credentials: the token is wrong, expired or revoked; generate a new one.
  • 403 Resource not accessible by personal access token: a permission above is missing or the repository is not selected on the token; edit the token. A 403 with X-RateLimit-Remaining: 0 means the rate limit (5,000 requests/hour) is used up; wait until X-RateLimit-Reset.
  • 404 Not Found: the repository is private and the token cannot see it, or owner/repo/number is wrong.
  • 422 Validation failed: the review comment points at a line that is not in the diff, or the PR is not mergeable; re-read the files and retry with a valid path/line.

Store the token as a VX Agents credential for this connector; never paste it into chat.

Usage guide

Setup

  • Add a GitHub fine-grained token as the credential (Pull requests read/write, Contents read, Issues read/write on the repositories to review).
  • Preset owner and repo if the agent always works on one repository. X-GitHub-Api-Version is pinned to 2022-11-28.

Review a pull request

  1. getPullRequest — read title, description, base/head branches and head.sha.
  2. listPullRequestFiles with per_page=100; keep calling with page=2,3… until fewer than 100 files come back. Each file's patch is the diff to review (very large files have no patch).
  3. Optional context: listPullRequestCommits, or compareCommits with basehead=base...head.
  4. Read what was already said: listPullRequestReviews, listPullRequestReviewComments, listIssueComments (use the PR number as issue_number). Do not repeat points already raised.
  5. Post ONE review with createPullRequestReview: commit_id = head SHA, body = summary, event = COMMENT, and comments = [{path, line, side: RIGHT, body}]. line is the line number in the new version of the file and must be inside the diff.
  6. Use event = APPROVE or REQUEST_CHANGES only after the user confirms.

Other workflows

  • Open a PR: createPullRequest with head (branch with changes, owner:branch for forks), base, title, body. Pushing the branch itself is done with the "GitHub Branches & File Commits" spec.
  • requestPullRequestReviewers with reviewers (usernames) or team_reviewers (team slugs).
  • updatePullRequest to edit title/body or close (state: closed).
  • mergePullRequest (merge_method: merge, squash or rebase) — ALWAYS ask the user first and pass sha = head SHA so a newer push is not merged by mistake.

Good to know

  • Confirm with the user before any write that posts comments, approves, requests changes, opens/closes or merges a PR.
  • createPullRequestReviewComment posts a single inline comment immediately; prefer one review with many comments.
  • pull_number and issue_number are the same PR number shown in the URL.
  • Timestamps are ISO 8601 UTC. Rate limit is 5,000 requests/hour per token; 422 usually means a comment line is outside the diff.

How to use this spec

  1. Create a free VX Agents account (sandbox tools included).
  2. Open the marketplace and connect “GitHub Pull Requests & Code Review” to an agent.
  3. Expose it as an MCP server for Claude/ChatGPT, or chat with it directly.

Related APIs