Skip to main content
Glama
Lexmata

Bitbucket Cloud MCP Server

by Lexmata

merge_pull_request

Merge open pull requests in Bitbucket Cloud using merge commit, squash, or fast-forward strategies to integrate code changes.

Instructions

Merge an open pull request. Supports merge commit, squash, and fast-forward strategies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceYesThe workspace slug
repo_slugYesThe repository slug
pr_idYesThe pull request ID
messageNoMerge commit message
close_source_branchNoClose source branch after merge
merge_strategyNoMerge strategy

Implementation Reference

  • Handler case in ToolHandler.handleTool that parses arguments and delegates to PullRequestsAPI.merge method.
    case 'merge_pull_request': { const params = toolSchemas.merge_pull_request.parse(args); const { workspace, repo_slug, pr_id, ...options } = params; return this.prs.merge(workspace, repo_slug, pr_id, options); }
  • Core implementation of the merge operation, performing POST request to Bitbucket API to merge the pull request.
    /** * Merge a pull request */ async merge( workspace: string, repo_slug: string, pr_id: number, options?: { message?: string; close_source_branch?: boolean; merge_strategy?: 'merge_commit' | 'squash' | 'fast_forward'; } ): Promise<BitbucketPullRequest> { return this.client.post<BitbucketPullRequest>( `/repositories/${workspace}/${repo_slug}/pullrequests/${pr_id}/merge`, options ); }
  • Zod schema for validating input parameters of the merge_pull_request tool.
    merge_pull_request: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), pr_id: z.number().describe('The pull request ID'), message: z.string().optional().describe('Merge commit message'), close_source_branch: z.boolean().optional().describe('Close source branch after merge'), merge_strategy: z .enum(['merge_commit', 'squash', 'fast_forward']) .optional() .describe('Merge strategy'), }),
  • Tool registration in the toolDefinitions array, including name, description, and input schema for MCP.
    { name: 'merge_pull_request', description: 'Merge an open pull request. Supports merge commit, squash, and fast-forward strategies.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, pr_id: { type: 'number', description: 'The pull request ID' }, message: { type: 'string', description: 'Merge commit message' }, close_source_branch: { type: 'boolean', description: 'Close source branch after merge' }, merge_strategy: { type: 'string', enum: ['merge_commit', 'squash', 'fast_forward'], description: 'Merge strategy', }, }, required: ['workspace', 'repo_slug', 'pr_id'], }, },

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