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; }

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