Skip to main content
Glama

gitlab_approve_merge_request

Approve merge requests after code review completion to enable merging. Use when changes are approved and ready for integration.

Instructions

Approve a merge request Returns: Approval status Use when: Code review complete, changes approved Note: Cannot approve your own MRs

Related tools:

  • gitlab_get_merge_request_approvals: Check status

  • gitlab_merge_merge_request: Merge after approval

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 executes the gitlab_approve_merge_request tool. It extracts or detects the project_id, requires the mr_iid argument, and delegates to GitLabClient.approve_merge_request() to perform the approval.
    def handle_approve_merge_request(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle approving a merge request"""
        project_id = require_project_id(client, arguments)
        mr_iid = require_argument(arguments, "mr_iid")
        
        return client.approve_merge_request(project_id, mr_iid)
  • Pydantic/MCP schema definition for the tool, specifying input parameters: optional project_id (string) and required mr_iid (integer).
        name=TOOL_APPROVE_MR,
        description=desc.DESC_APPROVE_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"]
        }
    ),
  • Registration of the handler function in the TOOL_HANDLERS dictionary, which is used by server.py to dispatch tool calls to the appropriate handler.
    TOOL_APPROVE_MR: handle_approve_merge_request,
  • Tool schema registration in the MCP server's list_tools() method, exposing the tool to clients with name, description, and input schema.
        name="gitlab_approve_merge_request",
        description=desc.DESC_APPROVE_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 handler mapping, schemas, and registrations.
    TOOL_APPROVE_MR = "gitlab_approve_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: the action ('Approve'), a constraint ('Cannot approve your own MRs'), and the return value ('Approval status'). However, it lacks details on permissions required, error conditions, or rate limits, which would be helpful for a mutation tool.

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 efficiently structured with clear sections: purpose, returns, usage context, constraint, and related tools. Every sentence adds value without redundancy. It's front-loaded with the core action and appropriately sized for the tool's complexity.

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 (2 parameters, mutation operation) and no annotations or output schema, the description does well by covering purpose, usage guidelines, constraints, and alternatives. However, it could provide more behavioral context (e.g., what happens on success/failure, authentication requirements) to be fully complete for a mutation tool.

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%, providing detailed documentation for both parameters. The description adds no parameter-specific information beyond what the schema already covers. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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 specific action ('Approve a merge request') and resource ('merge request'), distinguishing it from sibling tools like 'gitlab_get_merge_request_approvals' (check status) and 'gitlab_merge_merge_request' (merge after approval). The verb 'approve' is precise and unambiguous.

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 ('Code review complete, changes approved') and when not to use ('Cannot approve your own MRs'), and provides clear alternatives ('gitlab_get_merge_request_approvals: Check status', 'gitlab_merge_merge_request: Merge after approval'). This gives comprehensive guidance for tool selection.

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