Skip to main content
Glama
RajuSudhar

Atlassian Bitbucket MCP Server

by RajuSudhar

bitbucket_approve_pr

Approve a pull request in a Bitbucket project and repository using the pull request ID.

Instructions

Approve a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesProject key
repoYesRepository slug
prIdYesPull request ID

Implementation Reference

  • Handler function for the bitbucket_approve_pr tool. Validates input using prRefShape, checks manage_pr permission, calls prApi.approve(), invalidates cache, and returns the result or an error.
    bitbucket_approve_pr: async (args: unknown): Promise<McpToolResult> => {
      const start = Date.now();
      try {
        const input = z.object(prRefShape).parse(args);
        requirePermission(config, 'manage_pr');
        log('info', 'tool start', { operation: 'tool_execute', toolName: 'bitbucket_approve_pr' });
        const result = await prApi.approve(input.project, input.repo, input.prId);
        invalidatePrCache(cache, config, input.project, input.repo, input.prId);
        log('info', 'tool end', {
          toolName: 'bitbucket_approve_pr',
          durationMs: Date.now() - start,
        });
        return textResult(result);
      } catch (err) {
        log('error', 'tool error', {
          toolName: 'bitbucket_approve_pr',
          error: String(err),
          durationMs: Date.now() - start,
        });
        return errorResult('APPROVE_FAILED', err instanceof Error ? err.message : String(err));
      }
    },
  • Input schema (prRefShape) defining project, repo, and prId fields used by bitbucket_approve_pr.
    export const prRefShape = { project, repo, prId } as const;
  • Registration entry pairing the tool name 'bitbucket_approve_pr' with its description, schema, and handler.
    {
      name: 'bitbucket_approve_pr',
      description: 'Approve a pull request',
      shape: prRefShape,
      handler: h.pr.bitbucket_approve_pr,
    },
  • API helper method that POSTs to /projects/{project}/repos/{repo}/pull-requests/{prId}/approve to approve a pull request.
    async approve(project: string, repo: string, prId: number): Promise<BitbucketComment> {
      return this.client.requestJson<BitbucketComment>(
        `/projects/${project}/repos/${repo}/pull-requests/${prId}/approve`,
        { method: 'POST' }
      );
  • Helper function to invalidate the cache entry for a pull request after approval.
    function invalidatePrCache(
      cache: Cache,
      config: Config,
      project: string,
      repo: string,
      prId: number
    ): void {
      cache.invalidate(`${config.bitbucketUrl}:pr:${project}/${repo}/${prId}`);
    }
Behavior3/5

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

With no annotations, the description carries full burden. It clearly states the action ('Approve'), indicating a state-changing but non-destructive operation. However, it does not disclose potential side effects, permissions, or return behavior.

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

Conciseness4/5

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

Single concise sentence with no extraneous text. Efficiently communicates the core purpose.

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

Completeness3/5

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

No output schema is provided; description omits what the tool returns (e.g., success status). However, for a simple approval action, the description combined with complete parameter schema is moderately adequate.

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?

Input schema covers 100% of parameters with descriptions. The description adds no further detail beyond the schema, so baseline score applies.

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

Purpose5/5

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

The description uses a specific verb ('Approve') and resource ('pull request'), clearly distinguishing it from sibling tools like bitbucket_add_pr_comment, bitbucket_resolve_comment, etc.

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

Usage Guidelines3/5

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

The description implies the tool is used to approve a pull request, but does not provide guidance on when to use it versus alternatives (e.g., bitbucket_add_pr_comment for commenting) or when not to use it.

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

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/RajuSudhar/atlassian-bitbucket-mcp'

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