Skip to main content
Glama

delete_branch_restriction

Remove branch restrictions in Bitbucket repositories to allow specific branch operations by deleting existing rules.

Instructions

Delete a branch restriction.

Args:
    repo_slug: Repository slug
    restriction_id: Restriction ID (from list_branch_restrictions)

Returns:
    Confirmation of deletion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_slugYes
restriction_idYes

Implementation Reference

  • MCP tool handler and registration for 'delete_branch_restriction'. This decorated function is called by the MCP server when the tool is invoked. It validates inputs via type hints (used as schema), calls the Bitbucket client helper, and formats the response.
    @mcp.tool()
    @handle_bitbucket_error
    @formatted
    def delete_branch_restriction(repo_slug: str, restriction_id: int) -> dict:
        """Delete a branch restriction.
    
        Args:
            repo_slug: Repository slug
            restriction_id: Restriction ID (from list_branch_restrictions)
    
        Returns:
            Confirmation of deletion
        """
        client = get_client()
        client.delete_branch_restriction(repo_slug, restriction_id)
        return {}
  • Core helper method in BitbucketClient class that performs the actual DELETE API request to Bitbucket to remove the specified branch restriction.
    def delete_branch_restriction(
        self, repo_slug: str, restriction_id: int
    ) -> bool:
        """Delete a branch restriction.
    
        Args:
            repo_slug: Repository slug
            restriction_id: Restriction ID to delete
    
        Returns:
            True if deleted successfully
        """
        self._request(
            "DELETE",
            self._repo_path(repo_slug, "branch-restrictions", str(restriction_id)),
        )
        return True
  • Pydantic model for branch restrictions. Used in list_branch_restrictions tool to parse API responses and obtain restriction_id for deletion.
    class BranchRestriction(BaseModel):
        """Branch restriction info."""
    
        id: int
        kind: str
        pattern: str = ""
        branch_match_kind: Optional[str] = None
        branch_type: Optional[str] = None
        value: Optional[int] = None
        users: list[str] = []
        groups: list[str] = []
    
        @classmethod
        def from_api(cls, data: dict) -> "BranchRestriction":
            return cls(
                id=data.get("id", 0),
                kind=data.get("kind", ""),
                pattern=data.get("pattern", ""),
                branch_match_kind=data.get("branch_match_kind"),
                branch_type=data.get("branch_type"),
                value=data.get("value"),
                users=[u.get("display_name", "") for u in data.get("users", [])],
                groups=[g.get("name", "") for g in data.get("groups", [])],
            )
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'Confirmation of deletion' as a return, which hints at output, but lacks critical details: whether this is destructive (likely yes, but not stated), permission requirements, error conditions, or side effects. For a deletion tool, this is a significant gap in safety and operational context.

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 efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence adds value: the first states the action, the second and third explain parameters, and the fourth describes output. No wasted words, and it's front-loaded with the core functionality.

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 the tool's complexity (a deletion operation with 2 parameters), no annotations, and no output schema, the description is minimally adequate. It covers parameters well and hints at output, but lacks details on behavioral aspects like permissions, errors, or confirmation format. For a destructive tool, this leaves gaps that could hinder safe agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful context for both parameters: repo_slug is documented as 'Repository slug' and restriction_id is explained with 'from list_branch_restrictions', clarifying its source. This goes beyond the bare schema (which only has titles) and provides practical guidance, though it could detail formats or constraints further.

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

Purpose4/5

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

The description clearly states the action ('Delete') and resource ('a branch restriction'), making the purpose immediately understandable. However, it doesn't differentiate this tool from other deletion tools like delete_group_permission or delete_repository, which would require mentioning the specific domain (branch management in version control).

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 usage by referencing 'restriction_id (from list_branch_restrictions)', suggesting this tool should be used after listing restrictions. However, it doesn't explicitly state when to use this versus alternatives (e.g., update operations) or provide context about prerequisites beyond the ID reference.

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

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