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
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| title | Yes | The pull request title | |
| source_branch | Yes | The source branch name | |
| destination_branch | Yes | The destination branch name | |
| description | No | The pull request description (optional) |
Implementation Reference
- src/BitbucketClient.ts:140-161 (handler)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'], }, }, - src/index.ts:502-527 (handler)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), }, ], }; }