Skip to main content
Glama
pdogra1299
by pdogra1299

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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Remove approval' implies a mutation operation, it lacks details on permissions required, whether the action is reversible, rate limits, or what happens if no approval exists. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It is front-loaded with the core action and resource, making it highly efficient and easy to parse, which is ideal for quick understanding by an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature and lack of annotations or output schema, the description is incomplete. It fails to address critical aspects like error conditions, response format, or behavioral nuances (e.g., idempotency), leaving the agent with insufficient context for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for all three parameters (workspace, repository, pull_request_id). The description does not add any parameter-specific details beyond what the schema provides, such as format examples or constraints, so it meets the baseline for high schema coverage without extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Remove approval from a pull request' clearly states the action (remove approval) and resource (pull request), making the purpose immediately understandable. However, it does not explicitly differentiate from sibling tools like 'remove_requested_changes' or 'update_pull_request', which might involve similar pull request modifications but serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., needing an existing approval to remove), exclusions, or comparisons to siblings like 'approve_pull_request' or 'remove_requested_changes', leaving the agent to infer usage context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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