get_branch
Retrieve details of a specific branch, including its latest commit information, from a Bitbucket Cloud repository.
Instructions
Get details of a specific branch including its latest commit.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| branch_name | Yes | The branch name |
Implementation Reference
- src/tools/index.ts:990-993 (handler)The handler case in ToolHandler.handleTool that parses arguments using the tool schema and calls BranchesAPI.get to retrieve the branch details.case 'get_branch': { const params = toolSchemas.get_branch.parse(args); return this.branches.get(params.workspace, params.repo_slug, params.branch_name); }
- src/tools/index.ts:156-160 (schema)Zod schema definition for validating the input parameters of the get_branch tool.get_branch: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), branch_name: z.string().describe('The branch name'), }),
- src/tools/index.ts:586-598 (registration)Tool registration in the toolDefinitions array, providing name, description, and JSON input schema for MCP protocol.{ name: 'get_branch', description: 'Get details of a specific branch including its latest commit.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, branch_name: { type: 'string', description: 'The branch name' }, }, required: ['workspace', 'repo_slug', 'branch_name'], }, },
- src/api/branches.ts:26-30 (helper)Supporting method in BranchesAPI that performs the actual Bitbucket API GET request to fetch the specific branch details.async get(workspace: string, repo_slug: string, branch_name: string): Promise<BitbucketBranch> { return this.client.get<BitbucketBranch>( `/repositories/${workspace}/${repo_slug}/refs/branches/${encodeURIComponent(branch_name)}` ); }