Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

list_branches

Retrieve all branches from a Bitbucket Cloud repository, with options to filter, sort, and paginate results for efficient branch management.

Instructions

List all branches in a repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
qNoQuery string for filtering
sortNoSort field
pageNoPage number
pagelenNoResults per page

Implementation Reference

  • Tool handler case for 'list_branches' that parses arguments using Zod schema and delegates to BranchesAPI.list method.
    case 'list_branches': {
      const params = toolSchemas.list_branches.parse(args);
      return this.branches.list(params);
    }
  • BranchesAPI.list method that performs the actual Bitbucket API GET request to list branches.
    async list(params: ListBranchesParams): Promise<PaginatedResponse<BitbucketBranch>> {
      const { workspace, repo_slug, ...queryParams } = params;
      return this.client.get<PaginatedResponse<BitbucketBranch>>(
        `/repositories/${workspace}/${repo_slug}/refs/branches`,
        queryParams as Record<string, string | number | undefined>
      );
    }
  • Zod input schema definition for the list_branches tool used for validation in the handler.
    list_branches: z.object({
      workspace: z.string().describe('The workspace slug'),
      repo_slug: z.string().describe('The repository slug'),
      q: z.string().optional().describe('Query string for filtering'),
      sort: z.string().optional().describe('Sort field'),
      page: z.number().optional().describe('Page number'),
      pagelen: z.number().optional().describe('Results per page'),
    }),
  • MCP tool registration/definition for 'list_branches' including name, description, and input schema.
    {
      name: 'list_branches',
      description: 'List all branches in a repository.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          workspace: { type: 'string', description: 'The workspace slug' },
          repo_slug: { type: 'string', description: 'The repository slug' },
          q: { type: 'string', description: 'Query string for filtering' },
          sort: { type: 'string', description: 'Sort field' },
          page: { type: 'number', description: 'Page number' },
          pagelen: { type: 'number', description: 'Results per page' },
        },
        required: ['workspace', 'repo_slug'],
      },
    },
  • TypeScript interface defining the parameters for list_branches, used in BranchesAPI.
    export interface ListBranchesParams {
      workspace: string;
      repo_slug: string;
      q?: string;
      sort?: string;
      page?: number;
      pagelen?: number;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the basic action ('List all branches') without mentioning key traits like pagination behavior (implied by 'page' and 'pagelen' parameters but not explained), rate limits, authentication requirements, or error handling, which are critical for a tool with multiple parameters.

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 unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly and accurately.

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 moderate complexity (6 parameters, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic action but lacks context on usage, behavioral traits, and output details, which are needed for effective tool invocation in a multi-tool environment.

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, so the schema already documents all parameters (e.g., 'workspace', 'repo_slug', 'q', 'sort', 'page', 'pagelen'). The description adds no additional meaning beyond the schema, such as explaining how filtering with 'q' works or default values for optional parameters, meeting the baseline for high schema coverage.

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 verb ('List') and resource ('all branches in a repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_branch' (which retrieves a single branch) or 'list_repositories' (which lists repositories rather than branches), so it lacks full sibling distinction.

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 scenarios like filtering needs (e.g., using 'q' parameter vs. other tools), prerequisites (e.g., required authentication), or comparisons to siblings such as 'get_branch' for single-branch retrieval, leaving the agent with no usage context.

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