Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

delete_branch

Remove a branch from a Bitbucket Cloud repository to clean up your codebase and manage version control effectively.

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

  • Tool handler in ToolHandler.handleTool that dispatches to BranchesAPI.delete after parsing inputs.
    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' }; }
  • BranchesAPI.delete method that performs the actual HTTP DELETE request to Bitbucket API endpoint to delete the specified 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)}` ); }
  • Zod schema for validating inputs to the delete_branch tool: workspace, repo_slug, branch_name.
    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'), }),
  • MCP tool definition registration with 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'], }, },

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