Skip to main content
Glama

gitlab_get_merge_request_changes

Retrieve complete file diffs for a GitLab merge request to review all code changes. Displays full file diffs with context for entire MR, including all commits. Use for detailed code review.

Instructions

Get detailed MR file changes Returns: Complete diffs for all files Use when: Reviewing code changes Shows: Full file diffs with context

Similar to commit diff but for entire MR Includes all commits in the MR

Related tools:

  • gitlab_get_merge_request: MR overview

  • gitlab_smart_diff: Customizable diffs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mr_iidYesMerge request number (IID - Internal ID) Type: integer Format: Project-specific MR number (without !) Required: Yes Examples: - 456 (for MR !456) - 7890 (for MR !7890) How to find: Look at MR URL or title - URL: https://gitlab.com/group/project/-/merge_requests/456 → use 456 - Title: "Add new feature (!456)" → use 456 Note: This is NOT the global MR ID
project_idNoProject identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted

Implementation Reference

  • The primary handler function that implements the tool logic. It validates inputs, detects project if needed, and calls the underlying GitLabClient to fetch the merge request changes.
    def handle_get_merge_request_changes(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle getting merge request changes""" project_id = require_project_id(client, arguments) mr_iid = require_argument(arguments, "mr_iid") return client.get_merge_request_changes(project_id, mr_iid)
  • Defines the tool's input schema, including parameters for project_id (optional, auto-detected) and required mr_iid, along with description.
    types.Tool( name=TOOL_GET_MR_CHANGES, description=desc.DESC_GET_MR_CHANGES, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID}, "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID} }, "required": ["mr_iid"] } ),
  • Registers the handle_get_merge_request_changes function to the tool name TOOL_GET_MR_CHANGES in the TOOL_HANDLERS dictionary used by the MCP server.
    TOOL_GET_MR_CHANGES: handle_get_merge_request_changes,
  • Imports the TOOL_GET_MR_CHANGES constant for use in the module.
    TOOL_GET_MR_APPROVALS, TOOL_GET_MR_DISCUSSIONS, TOOL_GET_MR_CHANGES,
  • Defines the constant TOOL_GET_MR_CHANGES holding the exact tool name string used throughout the codebase.
    TOOL_GET_MR_CHANGES = "gitlab_get_merge_request_changes"

Other Tools

Related Tools

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/Vijay-Duke/mcp-gitlab'

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