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; }

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