Skip to main content
Glama

unapprove_pull_request

Remove approval from a pull request in Bitbucket by specifying the workspace, repository, and pull request ID. Manage PR lifecycle and code review efficiently with Bitbucket MCP Server integration.

Instructions

Remove approval from a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pull_request_idYesPull request ID
repositoryYesRepository slug (e.g., "my-repo")
workspaceYesBitbucket workspace/project key (e.g., "PROJ")

Implementation Reference

  • Core implementation of the unapprove_pull_request tool. Validates input using isApprovePullRequestArgs guard, then calls Bitbucket API: for Server - PUT /participants/{username} with status 'UNAPPROVED'; for Cloud - DELETE /approve. Returns success message or handles errors.
    async handleUnapprovePullRequest(args: any) { if (!isApprovePullRequestArgs(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for unapprove_pull_request' ); } const { workspace, repository, pull_request_id } = args; try { let apiPath: string; if (this.apiClient.getIsServer()) { // Bitbucket Server API - use participants endpoint const username = this.username.replace('@', '_'); apiPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/pull-requests/${pull_request_id}/participants/${username}`; await this.apiClient.makeRequest<any>('put', apiPath, { status: 'UNAPPROVED' }); } else { // Bitbucket Cloud API apiPath = `/repositories/${workspace}/${repository}/pullrequests/${pull_request_id}/approve`; await this.apiClient.makeRequest<any>('delete', apiPath); } return { content: [ { type: 'text', text: JSON.stringify({ message: 'Pull request approval removed successfully', pull_request_id, unapproved_by: this.username }, null, 2), }, ], }; } catch (error) { return this.apiClient.handleApiError(error, `removing approval from pull request ${pull_request_id} in ${workspace}/${repository}`); } }
  • Tool schema definition including name, description, and inputSchema specifying required parameters: workspace, repository, pull_request_id.
    { name: 'unapprove_pull_request', description: 'Remove approval from a pull request', inputSchema: { type: 'object', properties: { workspace: { type: 'string', description: 'Bitbucket workspace/project key (e.g., "PROJ")', }, repository: { type: 'string', description: 'Repository slug (e.g., "my-repo")', }, pull_request_id: { type: 'number', description: 'Pull request ID', }, }, required: ['workspace', 'repository', 'pull_request_id'], }, },
  • src/index.ts:126-127 (registration)
    Tool registration in the main switch statement that dispatches CallToolRequest to the ReviewHandlers.handleUnapprovePullRequest method.
    case 'unapprove_pull_request': return this.reviewHandlers.handleUnapprovePullRequest(request.params.arguments);

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/pdogra1299/bitbucket-mcp-server'

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