Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYesProject ID or complete URL-encoded path to project
fromYesThe base branch or commit SHA to compare from
toYesThe target branch or commit SHA to compare to
straightNoComparison method: false for '...' (default), true for '--'
excluded_file_patternsNoArray 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

  • 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\"]" ), });
  • 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(), });
  • 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(), });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/harshmaur/gitlab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server