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
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Bitbucket project key. If omitted, uses BITBUCKET_DEFAULT_PROJECT environment variable. | |
| repository | Yes | Repository slug containing the pull request. | |
| prId | Yes | Pull request ID to decline. | |
| message | No | Reason for declining the pull request. Helps the author understand why it was rejected. |
Implementation Reference
- src/index.ts:748-769 (handler)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'] } },
- src/index.ts:471-478 (handler)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); }
- src/index.ts:42-44 (schema)Type definition for PullRequestParams used in the decline_pull_request tool input validation and handler parameters.interface PullRequestParams extends RepositoryParams { prId?: number; }