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

  • Core handler function in BranchesAPI that executes the Bitbucket API POST request to create a new branch from the specified target.
    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 },
        }
      );
    }
  • Tool registration definition including name, description, and input schema for MCP tool registration.
      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'],
      },
    },
  • Zod schema used for input validation and parsing in the tool handler.
    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'),
    }),
  • Dispatch handler case in ToolHandler.handleTool that parses input and delegates to BranchesAPI.create.
    case 'create_branch': {
      const params = toolSchemas.create_branch.parse(args);
      return this.branches.create(params);
    }
  • TypeScript interface defining the input parameters for the create branch operation.
    export interface CreateBranchParams {
      workspace: string;
      repo_slug: string;
      name: string;
      target: string;
    }
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. While 'Create' implies a write operation, it doesn't address permission requirements, whether the branch becomes the current working branch, error conditions (e.g., duplicate branch names), or what happens if the target doesn't exist. This leaves significant behavioral gaps for a mutation tool.

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, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized for a straightforward creation tool.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after creation (e.g., does it return the new branch object?), error conditions, or integration with sibling tools. The context signals show this is a 4-parameter tool with significant behavioral implications that aren't addressed.

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 schema description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by implying the relationship between 'name' and 'target' parameters, but doesn't provide additional context about parameter constraints or interactions.

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 ('Create a new branch') and specifies the source ('from a specific commit or existing branch'), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'list_branches' or 'delete_branch' beyond the obvious action difference.

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. There's no mention of prerequisites, when not to use it, or how it relates to sibling tools like 'create_pull_request' or 'merge_pull_request' in a typical workflow.

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