Skip to main content
Glama
jlromano

Bitbucket MCP Server

by jlromano

create_pull_request

Create a new pull request in Bitbucket to propose code changes from a source branch to a destination branch for review and merging.

Instructions

Create a new pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
titleYesThe pull request title
source_branchYesThe source branch name
destination_branchYesThe destination branch name
descriptionNoThe pull request description (optional)

Implementation Reference

  • The actual implementation of createPullRequest in BitbucketClient.ts.
    async createPullRequest(
      workspace: string,
      repoSlug: string,
      title: string,
      sourceBranch: string,
      destinationBranch: string,
      description?: string
    ): Promise<PullRequest> {
      const data = {
        title,
        description,
        source: {
          branch: { name: sourceBranch }
        },
        destination: {
          branch: { name: destinationBranch }
        }
      };
      
      const response = await this.api.post(`/repositories/${workspace}/${repoSlug}/pullrequests`, data);
      return response.data;
    }
  • src/index.ts:170-202 (registration)
    The MCP tool registration for 'create_pull_request'.
      name: 'create_pull_request',
      description: 'Create a new pull request',
      inputSchema: {
        type: 'object',
        properties: {
          workspace: {
            type: 'string',
            description: 'The workspace slug',
          },
          repo_slug: {
            type: 'string',
            description: 'The repository slug',
          },
          title: {
            type: 'string',
            description: 'The pull request title',
          },
          source_branch: {
            type: 'string',
            description: 'The source branch name',
          },
          destination_branch: {
            type: 'string',
            description: 'The destination branch name',
          },
          description: {
            type: 'string',
            description: 'The pull request description (optional)',
          },
        },
        required: ['workspace', 'repo_slug', 'title', 'source_branch', 'destination_branch'],
      },
    },
  • The tool handler switch case for 'create_pull_request' which calls the BitbucketClient method.
    case 'create_pull_request': {
      const { workspace, repo_slug, title, source_branch, destination_branch, description } = args as {
        workspace: string;
        repo_slug: string;
        title: string;
        source_branch: string;
        destination_branch: string;
        description?: string;
      };
      const pullRequest = await client.createPullRequest(
        workspace,
        repo_slug,
        title,
        source_branch,
        destination_branch,
        description
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(pullRequest, null, 2),
          },
        ],
      };
    }

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