Skip to main content
Glama

gitlab_approve_merge_request

Approve a GitLab merge request after code review completion. Submit project ID and MR number to confirm approval. Cannot approve your own requests.

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
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 handler function that executes the gitlab_approve_merge_request tool. It validates the project ID (auto-detecting from git if needed) and MR IID, then calls the GitLabClient's approve_merge_request method.
    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 gitlab_approve_merge_request tool input, specifying project_id (string, optional) 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, mapping the tool name TOOL_APPROVE_MR ("gitlab_approve_merge_request") to its handler. This dict is used by server.py to dispatch tool calls.
    TOOL_APPROVE_MR: handle_approve_merge_request,
  • Explicit registration of the tool in the MCP server's list_tools() method, defining name, description, and input schema for gitlab_approve_merge_request.
    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, used consistently across handler registration, schemas, and server code.
    TOOL_APPROVE_MR = "gitlab_approve_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