Skip to main content
Glama

decline_pr

Close a pull request without merging it in Bitbucket. Use this tool to reject pull requests that should not be integrated into the codebase.

Instructions

Decline (close without merging) a pull request.

Args:
    repo_slug: Repository slug
    pr_id: Pull request ID

Returns:
    Declined PR info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
pr_idYes

Implementation Reference

  • MCP tool handler for 'decline_pr': decorated with @mcp.tool(), calls BitbucketClient.decline_pr to decline the pull request and returns formatted response.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def decline_pr(repo_slug: str, pr_id: int) -> dict:
        """Decline (close without merging) a pull request.
    
        Args:
            repo_slug: Repository slug
            pr_id: Pull request ID
    
        Returns:
            Declined PR info
        """
        client = get_client()
        result = client.decline_pr(repo_slug, pr_id)
        return {
            "pr_id": pr_id,
            "state": result.get("state"),
        }
  • Helper method on BitbucketClient that performs the actual API POST request to decline the PR.
    def decline_pr(
        self, repo_slug: str, pr_id: int
    ) -> dict[str, Any]:
        """Decline (close) a pull request.
    
        Args:
            repo_slug: Repository slug
            pr_id: Pull request ID
    
        Returns:
            Declined PR info
        """
        result = self._request(
            "POST",
            self._repo_path(repo_slug, "pullrequests", str(pr_id), "decline"),
        )
        return self._require_result(result, "decline PR", f"#{pr_id}")

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

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