Skip to main content
Glama
garc33

Bitbucket Server MCP

by garc33

decline_pull_request

Reject pull requests that should not be merged due to unacceptable changes, project conflicts, or significant rework needed. Closes PRs without merging.

Instructions

Decline or reject a pull request that should not be merged. Use this when changes are not acceptable, conflicts with project direction, or when the PR needs significant rework. This closes the PR without merging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNoBitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.
repositoryYesRepository slug containing the pull request.
prIdYesPull request ID to decline.
messageNoReason for declining the pull request. Helps the author understand why it was rejected.

Implementation Reference

  • The primary handler function that performs the actual logic to decline a pull request by sending a POST request to the Bitbucket API decline endpoint with the required parameters and optional message.
    private async declinePullRequest(params: PullRequestParams, message?: string) {
      const { project, repository, prId } = params;
      
      if (!project || !repository || !prId) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Project, repository, and prId are required'
        );
      }
      
      const response = await this.api.post(
        `/projects/${project}/repos/${repository}/pull-requests/${prId}/decline`,
        {
          version: -1,
          message
        }
      );
    
      return {
        content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }]
      };
    }
  • src/index.ts:242-255 (registration)
    Registration of the 'decline_pull_request' tool in the ListToolsRequestSchema response, defining the tool name, description, and input schema.
    {
      name: 'decline_pull_request',
      description: 'Decline or reject a pull request that should not be merged. Use this when changes are not acceptable, conflicts with project direction, or when the PR needs significant rework. This closes the PR without merging.',
      inputSchema: {
        type: 'object',
        properties: {
          project: { type: 'string', description: 'Bitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable.' },
          repository: { type: 'string', description: 'Repository slug containing the pull request.' },
          prId: { type: 'number', description: 'Pull request ID to decline.' },
          message: { type: 'string', description: 'Reason for declining the pull request. Helps the author understand why it was rejected.' }
        },
        required: ['repository', 'prId']
      }
    },
  • Handler dispatcher case within the CallToolRequestSchema that validates and prepares parameters before invoking the main declinePullRequest handler.
    case 'decline_pull_request': {
      const declinePrParams: PullRequestParams = {
        project: getProject(args.project as string),
        repository: args.repository as string,
        prId: args.prId as number
      };
      return await this.declinePullRequest(declinePrParams, args.message as string);
    }
  • Type definition for PullRequestParams used in the decline_pull_request tool input validation and handler parameters.
    interface PullRequestParams extends RepositoryParams {
      prId?: number;
    }
Behavior3/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. It discloses that the action 'declines or rejects' and 'closes the PR without merging,' which implies a destructive mutation. However, it lacks details on permissions required, whether the action is reversible, or any rate limits. It adds some behavioral context but is incomplete for a mutation tool.

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 front-loaded with the core action and usage guidelines in two concise sentences. Every sentence earns its place by clarifying purpose, when to use, and the outcome, with no wasted words. It is appropriately sized for the tool's complexity.

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?

Given no annotations and no output schema, the description is moderately complete. It covers purpose and usage well but lacks details on behavioral aspects like permissions or reversibility. For a mutation tool with 4 parameters and no structured safety hints, it should provide more context on risks or requirements, leaving some gaps.

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%, so the schema already documents all parameters. The description does not add any additional meaning or syntax details beyond what the schema provides. It mentions a 'reason for declining' which aligns with the 'message' parameter but doesn't elaborate further. Baseline 3 is appropriate when the schema handles parameter documentation.

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 clearly states the specific action ('decline or reject a pull request') and resource ('pull request'), distinguishing it from siblings like 'merge_pull_request' by specifying it 'closes the PR without merging.' It avoids tautology by explaining the outcome rather than just restating the name.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'when changes are not acceptable, conflicts with project direction, or when the PR needs significant rework.' It also distinguishes from alternatives by noting it 'closes the PR without merging,' contrasting with 'merge_pull_request.' This provides clear context and exclusions.

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

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