unapprove_merge_request
Remove approval from a GitLab merge request to indicate changes are needed before merging. Use this tool to revoke previous approval when new issues are identified in the code review process.
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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| merge_request_iid | Yes |
Input Schema (JSON Schema)
{
"properties": {
"merge_request_iid": {
"title": "Merge Request Iid",
"type": "string"
},
"project_id": {
"title": "Project Id",
"type": "string"
}
},
"required": [
"project_id",
"merge_request_iid"
],
"type": "object"
}
Implementation Reference
- server.py:355-374 (handler)Handler function that unapproves a GitLab merge request by calling mr.unapprove() and returns the MR details.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()