compare_branches
Compare two branches in a Bitbucket repository to identify differences in code, commits, or changes before merging or reviewing.
Instructions
Compare two branches
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| source_branch | Yes | The source branch | |
| destination_branch | Yes | The destination branch |
Implementation Reference
- src/BitbucketClient.ts:206-214 (handler)The actual implementation of the compareBranches logic.
async compareBranches( workspace: string, repoSlug: string, sourceBranch: string, destinationBranch: string ): Promise<any> { const response = await this.api.get(`/repositories/${workspace}/${repoSlug}/diff/${sourceBranch}..${destinationBranch}`); return response.data; } - src/index.ts:361-385 (schema)The registration and input schema for the compare_branches tool.
{ name: 'compare_branches', description: 'Compare two branches', inputSchema: { type: 'object', properties: { workspace: { type: 'string', description: 'The workspace slug', }, repo_slug: { type: 'string', description: 'The repository slug', }, source_branch: { type: 'string', description: 'The source branch', }, destination_branch: { type: 'string', description: 'The destination branch', }, }, required: ['workspace', 'repo_slug', 'source_branch', 'destination_branch'], }, - src/index.ts:649-667 (handler)The tool handler in index.ts that calls the BitbucketClient.
case 'compare_branches': { const { workspace, repo_slug, source_branch, destination_branch } = args as { workspace: string; repo_slug: string; source_branch: string; destination_branch: string; }; const diff = await client.compareBranches(workspace, repo_slug, source_branch, destination_branch); return { content: [ { type: 'text', text: JSON.stringify(diff, null, 2), }, ], }; } default: