get_commit_diff
Retrieve the detailed changes for a specific commit in a Bitbucket Cloud repository to review modifications and understand code evolution.
Instructions
Get the diff for a specific commit showing all changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | The workspace slug | |
| repo_slug | Yes | The repository slug | |
| commit_hash | Yes | The commit hash |
Implementation Reference
- src/tools/index.ts:1013-1021 (handler)Handler case in ToolHandler.handleTool method that parses arguments with Zod schema and calls CommitsAPI.getDiff to retrieve and return the commit diff.case 'get_commit_diff': { const params = toolSchemas.get_commit_diff.parse(args); const diff = await this.commits.getDiff( params.workspace, params.repo_slug, params.commit_hash ); return { diff }; }
- src/tools/index.ts:192-196 (schema)Zod schema defining the input parameters for the get_commit_diff tool: workspace, repo_slug, and commit_hash.get_commit_diff: z.object({ workspace: z.string().describe('The workspace slug'), repo_slug: z.string().describe('The repository slug'), commit_hash: z.string().describe('The commit hash'), }),
- src/tools/index.ts:659-671 (registration)MCP tool definition registration in toolDefinitions array, including name, description, and JSON schema for inputs.{ name: 'get_commit_diff', description: 'Get the diff for a specific commit showing all changes.', inputSchema: { type: 'object' as const, properties: { workspace: { type: 'string', description: 'The workspace slug' }, repo_slug: { type: 'string', description: 'The repository slug' }, commit_hash: { type: 'string', description: 'The commit hash' }, }, required: ['workspace', 'repo_slug', 'commit_hash'], }, },
- src/api/commits.ts:47-49 (helper)Helper method in CommitsAPI class that makes a raw GET request to Bitbucket's commit diff API endpoint.async getDiff(workspace: string, repo_slug: string, commit_hash: string): Promise<string> { return this.client.getRaw(`/repositories/${workspace}/${repo_slug}/diff/${commit_hash}`); }