Skip to main content
Glama

gitlab_get_merge_request

Retrieve detailed merge request information including pipelines, approvals, and conflicts to review MR status and readiness for merging. Requires MR IID for specific project identification.

Instructions

Get complete merge request details Returns: Full MR data with pipelines, approvals, conflicts Use when: Reviewing MR, checking merge status Required: MR IID (e.g., 456 for MR !456)

What's IID?: Internal ID - the MR number shown in GitLab Example: For MR !456, use iid=456

Returns: { "iid": 456, "title": "Add new feature", "state": "opened", "merge_status": "can_be_merged", "pipeline": {"status": "success"}, "approvals_required": 2, "approvals_left": 1, "changes_count": "15", "has_conflicts": false, "diff_stats": { "additions": 150, "deletions": 30 } }

Related tools:

  • gitlab_get_merge_request_changes: See actual diffs

  • gitlab_get_merge_request_discussions: Read reviews

  • gitlab_approve_merge_request: Approve MR

  • gitlab_merge_merge_request: Merge MR

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

  • Handler function that retrieves a single merge request by project ID and MR IID using the GitLabClient.
    def handle_get_merge_request(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle getting single merge request""" project_id = require_project_id(client, arguments) mr_iid = require_argument(arguments, "mr_iid") return client.get_merge_request(project_id, mr_iid)
  • Registration of the tool handler in the TOOL_HANDLERS dictionary, mapping 'gitlab_get_merge_request' to handle_get_merge_request.
    TOOL_GET_MERGE_REQUEST: handle_get_merge_request,
  • Pydantic/MCP schema definition for the gitlab_get_merge_request tool, specifying input parameters project_id and required mr_iid.
    types.Tool( name=TOOL_GET_MERGE_REQUEST, description=desc.DESC_GET_MR, 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"] } ),
  • Tool registration in server.py's handle_list_tools() method, exposing the tool schema to MCP clients.
    types.Tool( name="gitlab_get_merge_request", description=desc.DESC_GET_MR, 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"] } ),
  • Constant definition for the tool name 'gitlab_get_merge_request', used across the codebase for consistency.
    TOOL_GET_MERGE_REQUEST = "gitlab_get_merge_request"

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