approve_pull_request
Approve a pull request in Bitbucket Cloud to merge code changes after review, using workspace, repository, and pull request ID.
Instructions
Approve a pull request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| pr_id | Yes | The pull request ID |
Implementation Reference
- src/tools/index.ts:951-955 (handler)The handler case in ToolHandler.handleTool that parses arguments, calls the PullRequestsAPI.approve method, and returns a success message.case 'approve_pull_request': { const params = toolSchemas.approve_pull_request.parse(args); await this.prs.approve(params.workspace, params.repo_slug, params.pr_id); return { success: true, message: 'Pull request approved' }; }
- src/tools/index.ts:111-115 (schema)Zod schema definition for the input parameters of the approve_pull_request tool.approve_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'), }),
- src/tools/index.ts:497-509 (registration)Registration of the approve_pull_request tool in the toolDefinitions array for MCP, including name, description, and inputSchema.{ name: 'approve_pull_request', description: 'Approve a pull request.', 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' }, }, required: ['workspace', 'repo_slug', 'pr_id'], }, },
- src/api/pullrequests.ts:132-134 (helper)The approve method in PullRequestsAPI class that sends a POST request to the Bitbucket API endpoint to approve the specified pull request.async approve(workspace: string, repo_slug: string, pr_id: number): Promise<void> { await this.client.post(`/repositories/${workspace}/${repo_slug}/pullrequests/${pr_id}/approve`); }