list_branches
Retrieve all branches in a Bitbucket Cloud repository to view, filter, and manage branch information for development workflows.
Instructions
List all branches in a repository.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| q | No | Query string for filtering | |
| sort | No | Sort field | |
| page | No | Page number | |
| pagelen | No | Results per page |
Implementation Reference
- src/api/branches.ts:15-21 (handler)Core handler function that executes the tool logic by making a GET request to the Bitbucket API to list branches in a repository.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> ); }
- src/tools/index.ts:147-154 (schema)Zod schema defining and validating the input parameters for the list_branches tool.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'), }),
- src/tools/index.ts:571-585 (registration)Tool registration definition including name, description, and input schema for MCP protocol.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'], }, },
- src/tools/index.ts:986-989 (handler)Dispatch handler in ToolHandler that parses arguments and delegates to BranchesAPI.list.case 'list_branches': { const params = toolSchemas.list_branches.parse(args); return this.branches.list(params); }
- src/types/index.ts:302-309 (schema)TypeScript interface defining the input parameters for list branches.export interface ListBranchesParams { workspace: string; repo_slug: string; q?: string; sort?: string; page?: number; pagelen?: number; }