VX Agents

OpenAPI Marketplace · Developer Tools

Bitbucket Pull Requests & Code Review

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

Lets an agent review pull requests on Bitbucket Cloud: read the PR, its diff, diffstat, commits and comments, then post general or inline comments and approve or request changes once a person agrees. It can also create branches, open, update, merge or decline pull requests and read files at any commit. Curated from Atlassian's official Bitbucket Cloud OpenAPI specification.

Connect this API to an AI agent Browse all specs

What you can do with Bitbucket 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 /repositories/{workspace}/{repo_slug} getRepository Get a repository's details, including its main branch
GET /repositories/{workspace}/{repo_slug}/pullrequests listPullRequests List pull requests in a repository (open by default)
POST /repositories/{workspace}/{repo_slug}/pullrequests createPullRequest Open a new pull request from one branch into another
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id} getPullRequest Get one pull request with its description, branches and reviewers
PUT /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id} updatePullRequest Change a pull request's title, description, destination or reviewers
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diffstat getPullRequestDiffstat List the files changed in a pull request with lines added and removed
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/diff getPullRequestDiff Get the full text diff of a pull request
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/commits listPullRequestCommits List the commits in a pull request
GET /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments listPullRequestComments List general and inline comments on a pull request
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/comments createPullRequestComment Post a general comment or an inline comment on a line of the diff
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve approvePullRequest Approve a pull request (only after the user confirms)
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/approve removePullRequestApproval Withdraw your approval of a pull request
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes requestPullRequestChanges Mark a pull request as needing changes (only after the user confirms)
DELETE /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/request-changes removePullRequestChangeRequest Withdraw your request for changes on a pull request
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge mergePullRequest Merge a pull request (only after the user confirms)
POST /repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/decline declinePullRequest Decline (close without merging) a pull request (only after the user confirms)
GET /repositories/{workspace}/{repo_slug}/refs/branches listBranches List the open branches of a repository
POST /repositories/{workspace}/{repo_slug}/refs/branches createBranch Create a new branch from a commit
GET /repositories/{workspace}/{repo_slug}/src/{commit}/{path} getFileContent Read a file or list a folder at a given commit or branch

Authentication

basic

HTTP Basic

HTTP Basic auth: username = your Atlassian account email, password = an Atlassian API token with scopes for Bitbucket.

How to get a credential

  1. Sign in at https://id.atlassian.com/manage-profile/security/api-tokens.
  2. Click Create API token with scopes, give it a name and an expiry date.
  3. Choose the app Bitbucket.
  4. Select the scopes in the table below and create the token.
  5. Copy the token (shown once). Use your Atlassian account email as the username and the token as the password.

Bitbucket app passwords are deprecated and being replaced by API tokens; do not use them for new setups. Repository or workspace access tokens are sent as Authorization: Bearer instead and are not used by this credential.

Permissions used

Scope Operations
read:repository:bitbucket getRepository, listBranches, getFileContent
write:repository:bitbucket createBranch
read:pullrequest:bitbucket listPullRequests, getPullRequest, getPullRequestDiff, getPullRequestDiffstat, listPullRequestCommits, listPullRequestComments
write:pullrequest:bitbucket createPullRequestComment, approvePullRequest, removePullRequestApproval, requestPullRequestChanges, removePullRequestChangeRequest, createPullRequest, updatePullRequest, mergePullRequest, declinePullRequest

Common errors

  • 401 Unauthorized: wrong email/token pair, an expired token, or a Bitbucket username used instead of the email; recreate the token and use the account email.
  • 403 Forbidden: a scope above is missing, or your account has no write access to the repository (merge also needs branch permissions); create a token with the missing scope.
  • 400 Bad Request: invalid body, e.g. inline comment without inline.path, or a branch name that already exists.
  • 429 Too Many Requests: hourly rate limit reached; wait and retry later.

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

Usage guide

Setup

  • Credential: Atlassian account email as username + an Atlassian API token with Bitbucket scopes as password (read/write pull requests, read/write repositories). App passwords are being replaced by API tokens.
  • Preset workspace and repo_slug if the agent always works on one repository (both appear in the repository URL bitbucket.org/<workspace>/<repo_slug>).

Review a pull request

  1. getPullRequest — title, description, source/destination branches, reviewers.
  2. getPullRequestDiffstat — which files changed and how much (paginated: follow next).
  3. getPullRequestDiff — the full unified diff as text. For context on a file use getFileContent with commit = source branch name or commit hash.
  4. listPullRequestComments (and listPullRequestCommits if needed) — do not repeat points already raised.
  5. Post findings with createPullRequestComment: general comment = {content: {raw}}; inline comment adds inline: {path, to} where to is the line in the new file (use from for a removed line). Reply to a thread with parent: {id}.
  6. Only after the user confirms: approvePullRequest or requestPullRequestChanges (undo with removePullRequestApproval / removePullRequestChangeRequest).

Open, update, merge

  • New branch: listBranches → createBranch with name and target.hash (commit hash of the base). Committing files is not supported by this spec.
  • createPullRequest with title, source.branch.name, optional destination.branch.name, summary.raw, reviewers (uuid incl. braces).
  • updatePullRequest to change title/description/reviewers (a reviewers list replaces the current one).
  • mergePullRequest (merge_strategy, message) and declinePullRequest — ALWAYS confirm with the user first.

Good to know

  • Confirm with the user before any write that posts comments, approves, requests changes, creates/merges/declines a PR or creates a branch.
  • pull_request_id is the number in the PR URL. Lists page with page/pagelen (max 50) and return next when more exist.
  • Times are ISO 8601 UTC. User UUIDs are written with braces, e.g. {1234-…}.

How to use this spec

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

Related APIs