get_pr_diff
Retrieve the complete diff for a Bitbucket Cloud pull request to review all code changes before merging.
Instructions
Get the diff for a pull request showing all changes.
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:979-983 (handler)Handler case in ToolHandler.handleTool for the 'get_pr_diff' tool. Parses arguments using Zod schema and calls PullRequestsAPI.getDiff to retrieve the pull request diff.case 'get_pr_diff': { const params = toolSchemas.get_pr_diff.parse(args); const diff = await this.prs.getDiff(params.workspace, params.repo_slug, params.pr_id); return { diff }; }
- src/tools/index.ts:140-144 (schema)Zod input schema definition for the 'get_pr_diff' tool used for validation in the handler.get_pr_diff: 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:555-567 (registration)Tool registration/definition in toolDefinitions array for MCP, including name, description, and JSON input schema.{ name: 'get_pr_diff', description: 'Get the diff for a pull request showing all changes.', 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:199-201 (helper)Supporting method in PullRequestsAPI class that performs the actual API call to retrieve the pull request diff from Bitbucket.async getDiff(workspace: string, repo_slug: string, pr_id: number): Promise<string> { return this.client.getRaw(`/repositories/${workspace}/${repo_slug}/pullrequests/${pr_id}/diff`); }