Skip to main content
Glama

gitlab_get_merge_request

Retrieve detailed merge request information including status, pipelines, approvals, and conflicts to review and assess merge readiness in GitLab projects.

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
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
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

Implementation Reference

  • The core handler function that implements the gitlab_get_merge_request tool. It extracts the required project_id (auto-detects if not provided) and mr_iid from arguments, then calls the GitLabClient's get_merge_request method to fetch and return the merge request details.
    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 name to its handler function in the TOOL_HANDLERS dictionary, which is used by the MCP server to dispatch tool calls.
    TOOL_GET_MERGE_REQUEST: handle_get_merge_request,
  • Pydantic/MCP schema definition for the gitlab_get_merge_request tool, specifying input parameters and validation rules.
    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"]
        }
    ),
  • Constant definition for the tool name string, used consistently across the codebase for registration and references.
    TOOL_GET_MERGE_REQUEST = "gitlab_get_merge_request"
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it returns full MR data including pipelines, approvals, and conflicts, and specifies required parameters (MR IID). However, it doesn't mention rate limits, authentication needs, or error handling, leaving some gaps for a read operation.

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

Conciseness5/5

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

The description is well-structured and front-loaded with key information (purpose, returns, usage), followed by helpful details (parameter explanation, example, related tools). Every sentence earns its place without redundancy, making it efficient and easy to scan.

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?

Given the tool's moderate complexity (read operation with 2 parameters) and no output schema, the description provides a comprehensive example return structure, which compensates well. It covers purpose, usage, parameters, and sibling relationships, though it lacks details on authentication or error cases, which are minor gaps.

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 both parameters thoroughly. The description adds minimal value beyond the schema by explaining 'What's IID?' and providing an example, but doesn't add significant semantic context. Baseline 3 is appropriate as the schema does the heavy lifting.

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 the tool's purpose with specific verbs ('Get complete merge request details') and resource ('merge request'), and distinguishes it from siblings by listing related tools like gitlab_get_merge_request_changes for diffs and gitlab_get_merge_request_discussions for reviews. This provides precise differentiation beyond just the name.

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

Usage Guidelines5/5

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

The description explicitly states when to use it ('Use when: Reviewing MR, checking merge status') and lists related tools as alternatives for specific needs (e.g., 'gitlab_get_merge_request_changes: See actual diffs'). This gives clear guidance on context and when to choose other tools.

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

Install Server

Other 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