Skip to main content
Glama

get_merge_request_file_diff

Read-only

Retrieve file-level diffs from a merge request by its IID or source branch. Get exact code changes for specified file paths, read-only.

Instructions

Get diffs for specific files from a merge request (mergeRequestIid or branchName required). Use this for a known resource or result; choose the corresponding list or search tool when you need to discover multiple resources. It is read-only and does not mutate GitLab data; missing resources, invalid identifiers, insufficient permission, and rate limits are returned as errors. When project_id or group_id is accepted, provide the numeric ID or complete URL-encoded path described by the schema; use required identifiers and pagination fields exactly as documented.

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.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true. The description adds value by detailing error behavior: 'missing resources, invalid identifiers, insufficient permission, and rate limits are returned as errors.' This goes beyond the annotations and helps the agent anticipate failure modes. No contradiction with annotations.

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

Conciseness3/5

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

The description is relatively compact with the purpose front-loaded. However, it includes generic boilerplate about group_id and pagination fields that are not in the schema, and the parenthetical about required parameters is redundant and potentially misleading. This reduces efficiency and clarity.

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

Completeness3/5

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

The schema and annotations cover much of the necessary context, and the description adds usage and error information. However, the misleading statement about required parameters undermines completeness; an agent might try to supply merge_request_iid or source_branch instead of the actually required project_id and file_paths. This is a significant gap.

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

Parameters2/5

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

Schema description coverage is 100%, so the baseline would be 3. However, the description actively misleads by stating 'mergeRequestIid or branchName required' while the schema requires project_id and file_paths. It also references 'group_id' and 'pagination fields' which do not exist in this schema. This introduces confusion rather than adding semantic value, so a 2 is warranted.

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

Purpose5/5

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

The description clearly states 'Get diffs for specific files from a merge request', identifying the exact verb, resource, and scope. It distinguishes itself from siblings by explicitly noting to use list/search tools when discovering multiple resources, making its purpose unambiguous.

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?

Provides explicit guidance: 'Use this for a known resource or result; choose the corresponding list or search tool when you need to discover multiple resources.' This clearly indicates when to use this tool versus alternatives. It also instructs to use required identifiers exactly as documented. However, it does not name specific sibling tools like get_merge_request_diffs, so it lacks some specificity.

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

Deploy Server

Other Tools