Skip to main content
Glama
ffpy

GitLab MCP Code Review

by ffpy

approve_merge_request

Approve GitLab merge requests and optionally set required approval thresholds to manage code review workflows.

Instructions

Approve a merge request. Args: project_id: The GitLab project ID or URL-encoded path merge_request_iid: The merge request IID (project-specific ID) approvals_required: Optional number of required approvals to set Returns: Dict containing the approval information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes
approvals_requiredNo

Implementation Reference

  • The core handler function for the 'approve_merge_request' tool. It approves the specified merge request using the GitLab API and optionally updates the number of required approvals. The @mcp.tool() decorator registers it as an MCP tool, including automatic schema generation from the signature and docstring.
    @mcp.tool() def approve_merge_request(ctx: Context, project_id: str, merge_request_iid: str, approvals_required: Optional[int] = None) -> Dict[str, Any]: """ Approve a merge request. Args: project_id: The GitLab project ID or URL-encoded path merge_request_iid: The merge request IID (project-specific ID) approvals_required: Optional number of required approvals to set Returns: Dict containing the approval information """ gl = ctx.request_context.lifespan_context project = gl.projects.get(project_id) mr = project.mergerequests.get(merge_request_iid) mr.approve() if approvals_required is not None: mr.approvals.post({'approvals_required': approvals_required}) return mr.asdict()
  • server.py:479-479 (registration)
    The @mcp.tool() decorator registers the approve_merge_request function as an MCP tool.
    @mcp.tool()

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/ffpy/gitlab-mcp-code-review'

If you have feedback or need assistance with the MCP directory API, please join our Discord server