Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

create_pull_request

Create a pull request to merge code changes from a source branch to a destination branch in Bitbucket Cloud repositories.

Instructions

Create a new pull request from a source branch to a destination branch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
titleYesPull request title
source_branchYesSource branch name
destination_branchNoDestination branch (defaults to main branch)
descriptionNoPull request description
close_source_branchNoClose source branch after merge
reviewersNoList of reviewer UUIDs

Implementation Reference

  • Tool handler case in ToolHandler.handleTool that validates input with Zod schema and calls PullRequestsAPI.create to execute the tool.
    case 'create_pull_request': {
      const params = toolSchemas.create_pull_request.parse(args);
      return this.prs.create(params);
    }
  • Core implementation in PullRequestsAPI.create: destructures params, builds Bitbucket API request body, and performs POST request to create the pull request.
    async create(params: CreatePullRequestParams): Promise<BitbucketPullRequest> {
      const {
        workspace,
        repo_slug,
        title,
        source_branch,
        destination_branch,
        description,
        close_source_branch,
        reviewers,
      } = params;
    
      const body: Record<string, unknown> = {
        title,
        source: {
          branch: { name: source_branch },
        },
        close_source_branch: close_source_branch ?? false,
      };
    
      if (destination_branch) {
        body.destination = { branch: { name: destination_branch } };
      }
    
      if (description) {
        body.description = description;
      }
    
      if (reviewers && reviewers.length > 0) {
        body.reviewers = reviewers.map((uuid) => ({ uuid }));
      }
    
      return this.client.post<BitbucketPullRequest>(
        `/repositories/${workspace}/${repo_slug}/pullrequests`,
        body
      );
    }
  • MCP tool registration definition including name, description, and input schema.
    {
      name: 'create_pull_request',
      description: 'Create a new pull request from a source branch to a destination branch.',
      inputSchema: {
        type: 'object' as const,
        properties: {
          workspace: { type: 'string', description: 'The workspace slug' },
          repo_slug: { type: 'string', description: 'The repository slug' },
          title: { type: 'string', description: 'Pull request title' },
          source_branch: { type: 'string', description: 'Source branch name' },
          destination_branch: {
            type: 'string',
            description: 'Destination branch (defaults to main branch)',
          },
          description: { type: 'string', description: 'Pull request description' },
          close_source_branch: { type: 'boolean', description: 'Close source branch after merge' },
          reviewers: {
            type: 'array',
            items: { type: 'string' },
            description: 'List of reviewer UUIDs',
          },
        },
        required: ['workspace', 'repo_slug', 'title', 'source_branch'],
      },
    },
  • Zod schema for validating create_pull_request tool inputs.
    create_pull_request: z.object({
      workspace: z.string().describe('The workspace slug'),
      repo_slug: z.string().describe('The repository slug'),
      title: z.string().describe('Pull request title'),
      source_branch: z.string().describe('Source branch name'),
      destination_branch: z
        .string()
        .optional()
        .describe('Destination branch (defaults to main branch)'),
      description: z.string().optional().describe('Pull request description'),
      close_source_branch: z.boolean().optional().describe('Close source branch after merge'),
      reviewers: z.array(z.string()).optional().describe('List of reviewer UUIDs'),
    }),
  • TypeScript interface defining the parameters for create_pull_request.
    export interface CreatePullRequestParams {
      workspace: string;
      repo_slug: string;
      title: string;
      source_branch: string;
      destination_branch?: string;
      description?: string;
      close_source_branch?: boolean;
      reviewers?: string[];
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action is 'create' (implying a write/mutation operation) but doesn't disclose permissions needed, rate limits, whether it triggers notifications, what happens on failure, or typical response format. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action without unnecessary words. Every word earns its place by specifying the tool's primary function concisely.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 8 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after creation (e.g., PR status, review workflow initiation), error conditions, or relationship to sibling tools like 'merge_pull_request'. The agent lacks critical context for proper invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional parameter context beyond implying source/destination branch involvement, which is already covered in schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('create a new pull request') and specifies the key resources involved ('from a source branch to a destination branch'), which distinguishes it from sibling tools like 'create_issue' or 'create_branch'. However, it doesn't explicitly differentiate from 'update_pull_request' or mention that it's for initiating code review processes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_branch' for branch creation or 'update_pull_request' for modifying existing PRs. It doesn't mention prerequisites (e.g., needing existing branches) or contextual triggers (e.g., after completing feature development).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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