Skip to main content
Glama
jlromano

Bitbucket MCP Server

by jlromano

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
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
source_branchYesThe source branch
destination_branchYesThe destination branch

Implementation Reference

  • 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;
    }
  • 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'],
      },
  • 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:

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/jlromano/bitbucket-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server