Skip to main content
Glama
ffpy

GitLab MCP Code Review

by ffpy

unapprove_merge_request

Revoke approval from a GitLab merge request to prevent merging when changes require further review. Specify project and merge request IDs.

Instructions

Unapprove a merge request.

Args:
    project_id: The GitLab project ID or URL-encoded path
    merge_request_iid: The merge request IID (project-specific ID)
Returns:
    Dict containing the unapproval information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes

Implementation Reference

  • The main handler function for the 'unapprove_merge_request' tool. It is registered via the @mcp.tool() decorator. The function fetches the project and merge request using the GitLab client, attempts to unapprove the MR with mr.unapprove(), logs any errors, and returns the MR details.
    @mcp.tool()
    def unapprove_merge_request(ctx: Context, project_id: str, merge_request_iid: str) -> Dict[str, Any]:
        """
        Unapprove a merge request.
        
        Args:
            project_id: The GitLab project ID or URL-encoded path
            merge_request_iid: The merge request IID (project-specific ID)
        Returns:
            Dict containing the unapproval information
        """
        gl = ctx.request_context.lifespan_context
        project = gl.projects.get(project_id)
        mr = project.mergerequests.get(merge_request_iid)
        
        try:
            mr.unapprove()
        except Exception as e:
            logger.error(f"Failed to unapprove merge request {merge_request_iid}: {e}")
        
        return mr.asdict()

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