Skip to main content
Glama

get_merge_request_file_diff

Read-only

Retrieve diffs for specific files in a GitLab merge request to review code changes. Requires merge request IID or source branch; returns errors for missing resources or rate limits.

Instructions

Get diffs for specific files from a merge request (merge_request_iid or source_branch required). Read-only; missing resources, denied access, and rate limits return errors. project_id/group_id take a numeric ID or URL-encoded path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unidiffNoPresent diff in the unified diff format. Default is false.
jmespathNoOptional JMESPath expression filtering the JSON result before return.
file_pathsYesList of file paths to retrieve diffs for (e.g. ['src/api/users.ts', 'src/repo/user.go']). Call list_merge_request_changed_files first to get the full list of changed paths.
project_idYesProject ID or complete URL-encoded path to project
source_branchNoSource branch name
merge_request_iidNoThe IID of a merge request

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. Addedv2.1.18
  3. Removedv2.1.14
  4. Addedv2.1.11
  5. Removedv2.1.10
  6. Addedv2.1.9

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover read-only (readOnlyHint=true) and open-world scope, but the description adds genuinely new behavioral context: missing resources, denied access, and rate limits surface as errors. It does not describe pagination or response shape, but the error behavior is useful value beyond the structured hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences with the core action and the key requirement front-loaded, and no filler. The only wasted element is the dangling `group_id` reference, which is irrelevant to this tool's parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter read tool with no output schema, the description covers the required selector, ID formatting, error behavior, and the read-only nature. The schema already points to list_merge_request_changed_files for discovering paths, so the remaining gap (return format) is minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents every parameter, establishing a baseline of 3. The description mostly repeats schema content (URL-encoded path handling) and even references a `group_id` parameter that does not exist in this schema, which weakens rather than strengthens parameter guidance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (get diffs for specific files from a merge request), which is clearly narrower than the sibling get_merge_request_diffs/list_merge_request_diffs. It stops short of explicitly naming those siblings or explaining the scope contrast, so differentiation must be inferred from the word 'specific files'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a concrete prerequisite — merge_request_iid or source_branch is required — which tells the agent when this call is applicable. It does not name the alternative tools (get_merge_request_diffs, list_merge_request_diffs) or state when to prefer them, so exclusions are absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.