Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

create_branch

Create a new branch in Bitbucket Cloud from a specific commit or existing branch to organize development work and isolate changes.

Instructions

Create a new branch from a specific commit or existing branch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
nameYesNew branch name
targetYesTarget commit hash or branch name

Implementation Reference

  • ToolHandler.handleTool switch case for 'create_branch': parses input parameters using Zod schema and delegates to BranchesAPI.create method.
    case 'create_branch': { const params = toolSchemas.create_branch.parse(args); return this.branches.create(params); }
  • BranchesAPI.create method: extracts parameters and makes a POST request to Bitbucket API to create the branch from the target hash.
    async create(params: CreateBranchParams): Promise<BitbucketBranch> { const { workspace, repo_slug, name, target } = params; return this.client.post<BitbucketBranch>( `/repositories/${workspace}/${repo_slug}/refs/branches`, { name, target: { hash: target }, } ); }
  • Zod schema definition for create_branch tool input validation.
    create_branch: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), name: z.string().describe('New branch name'), target: z.string().describe('Target commit hash or branch name'), }),
  • MCP tool registration in toolDefinitions array, including name, description, and inputSchema.
    { name: 'create_branch', description: 'Create a new branch from a specific commit or existing branch.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, name: { type: 'string', description: 'New branch name' }, target: { type: 'string', description: 'Target commit hash or branch name' }, }, required: ['workspace', 'repo_slug', 'name', 'target'], }, },

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