Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

delete_branch

Remove branches from Bitbucket Cloud repositories to manage codebase structure and clean up unused or merged branches.

Instructions

Delete a branch from a repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
branch_nameYesThe branch name to delete

Implementation Reference

  • Handler case in ToolHandler.handleTool for the delete_branch tool. Parses arguments using the schema, calls BranchesAPI.delete, and returns a success message.
    case 'delete_branch': {
      const params = toolSchemas.delete_branch.parse(args);
      await this.branches.delete(params.workspace, params.repo_slug, params.branch_name);
      return { success: true, message: 'Branch deleted' };
    }
  • Zod input schema definition for the delete_branch tool in toolSchemas.
    delete_branch: z.object({
      workspace: z.string().describe('The workspace slug'),
      repo_slug: z.string().describe('The repository slug'),
      branch_name: z.string().describe('The branch name to delete'),
    }),
  • Registration of the delete_branch tool in the toolDefinitions array used for MCP, including name, description, and JSON schema for inputs.
    {
      name: 'delete_branch',
      description: 'Delete a branch from a repository.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          workspace: { type: 'string', description: 'The workspace slug' },
          repo_slug: { type: 'string', description: 'The repository slug' },
          branch_name: { type: 'string', description: 'The branch name to delete' },
        },
        required: ['workspace', 'repo_slug', 'branch_name'],
      },
    },
  • Core implementation in BranchesAPI.delete: sends DELETE request to Bitbucket API endpoint to delete the branch.
    async delete(workspace: string, repo_slug: string, branch_name: string): Promise<void> {
      await this.client.delete(
        `/repositories/${workspace}/${repo_slug}/refs/branches/${encodeURIComponent(branch_name)}`
      );
    }
Behavior2/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 of behavioral disclosure. While 'Delete' implies a destructive mutation, the description lacks critical details: it doesn't specify if deletion is permanent or reversible, what permissions are required, whether it affects associated data (e.g., pull requests), or what happens on success/failure. For a destructive tool with zero annotation coverage, 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 a single, direct sentence with zero wasted words, making it highly efficient and front-loaded. It immediately conveys the core action without unnecessary elaboration, which is ideal for quick comprehension in a tool list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature, lack of annotations, and no output schema, the description is insufficiently complete. It doesn't address critical aspects like return values (e.g., success confirmation or error details), side effects, or safety warnings. For a mutation tool that permanently removes data, more context is needed to ensure proper and safe usage by an agent.

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?

The input schema has 100% description coverage, with clear parameter definitions (workspace slug, repository slug, branch name). The description adds no additional semantic context beyond implying these parameters are needed to identify the branch. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't enhance or clarify parameter usage 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 from a repository'), making the purpose immediately understandable. It distinguishes itself from siblings like 'delete_repository' or 'delete_issue' by specifying the branch resource. However, it doesn't explicitly differentiate from other branch operations like 'create_branch' or 'get_branch' beyond the verb, which keeps it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., branch must exist, user permissions), exclusions (e.g., cannot delete protected branches), or related tools like 'create_branch' or 'list_branches'. Without such context, an agent might misuse it or overlook necessary checks.

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

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