get_branch_diffs
Compare changes between branches or commits in a GitLab project to identify code differences and review modifications.
Instructions
Get the changes/diffs between two branches or commits in a GitLab project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID or complete URL-encoded path to project | |
| from | Yes | The base branch or commit SHA to compare from | |
| to | Yes | The target branch or commit SHA to compare to | |
| straight | No | Comparison method: false for '...' (default), true for '--' | |
| excluded_file_patterns | No | Array of regex patterns to exclude files from the diff results. Each pattern is a JavaScript-compatible regular expression that matches file paths to ignore. Examples: ["^test/mocks/", "\.spec\.ts$", "package-lock\.json"] |
Implementation Reference
- schemas.ts:870-877 (schema)Input schema (GetBranchDiffsSchema) for the 'get_branch_diffs' tool, which defines parameters for comparing branches or commits in a GitLab project, including project_id (inherited), from, to, straight, and excluded_file_patterns.export const GetBranchDiffsSchema = ProjectParamsSchema.extend({ from: z.string().describe("The base branch or commit SHA to compare from"), to: z.string().describe("The target branch or commit SHA to compare to"), straight: z.boolean().optional().describe("Comparison method: false for '...' (default), true for '--'"), excluded_file_patterns: z.array(z.string()).optional().describe( "Array of regex patterns to exclude files from the diff results. Each pattern is a JavaScript-compatible regular expression that matches file paths to ignore. Examples: [\"^test/mocks/\", \"\\.spec\\.ts$\", \"package-lock\\.json\"]" ), });
- schemas.ts:504-517 (schema)Output schema (GitLabCompareResultSchema) likely used by the 'get_branch_diffs' tool, containing commits and diffs between branches.export const GitLabCompareResultSchema = z.object({ commit: z.object({ id: z.string().optional(), short_id: z.string().optional(), title: z.string().optional(), author_name: z.string().optional(), author_email: z.string().optional(), created_at: z.string().optional(), }).optional(), commits: z.array(GitLabCommitSchema), diffs: z.array(GitLabDiffSchema), compare_timeout: z.boolean().optional(), compare_same_ref: z.boolean().optional(), });
- schemas.ts:472-481 (schema)Schema for individual diff entries (GitLabDiffSchema) used in branch comparison results for the 'get_branch_diffs' tool.export const GitLabDiffSchema = z.object({ old_path: z.string(), new_path: z.string(), a_mode: z.string(), b_mode: z.string(), diff: z.string(), new_file: z.boolean(), renamed_file: z.boolean(), deleted_file: z.boolean(), });