Skip to main content
Glama

gitlab_get_merge_request_approvals

Check merge request approval status to determine if it can be merged. Shows required approvals, current approvals, and who approved.

Instructions

Check MR approval status Returns: Approval requirements and current state Use when: Checking if MR can be merged Shows: Required approvals, who approved

Example response: { "approvals_required": 2, "approvals_left": 1, "approved_by": [ {"user": {"username": "johndoe"}} ], "approval_rules": [...] }

Related tools:

  • gitlab_approve_merge_request: Add approval

  • gitlab_merge_merge_request: Merge when ready

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 main handler function for the tool. It resolves the project ID (auto-detecting from git if not provided), requires the mr_iid parameter, and delegates to the GitLabClient's get_merge_request_approvals method.
    def handle_get_merge_request_approvals(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting merge request approvals"""
        project_id = require_project_id(client, arguments)
        mr_iid = require_argument(arguments, "mr_iid")
        
        return client.get_merge_request_approvals(project_id, mr_iid)
  • Pydantic/MCP schema definition for the tool, including input parameters (project_id optional, mr_iid required) with descriptions and validation.
        name=TOOL_GET_MR_APPROVALS,
        description=desc.DESC_GET_MR_APPROVALS,
        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"]
        }
    ),
  • Registration of the handler function in the central TOOL_HANDLERS dictionary, mapping the tool name to its implementation.
    TOOL_GET_MR_APPROVALS: handle_get_merge_request_approvals,
  • Detailed description string for the tool used in schema definitions.
    DESC_GET_MR_APPROVALS = """Check MR approval status
    Returns: Approval requirements and current state
    Use when: Checking if MR can be merged
    Shows: Required approvals, who approved
    
    Example response:
    {
      "approvals_required": 2,
      "approvals_left": 1,
      "approved_by": [
        {"user": {"username": "johndoe"}}
      ],
      "approval_rules": [...]
    }
    
    Related tools:
    - gitlab_approve_merge_request: Add approval
    - gitlab_merge_merge_request: Merge when ready"""
  • Constant definition for the tool name string, used consistently across the codebase for registration and references.
    TOOL_GET_MR_APPROVALS = "gitlab_get_merge_request_approvals"

Tool Definition Quality

Score is being calculated. Check back soon.

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