approve_merge_request
Approve a GitLab merge request to merge code changes into the target branch after review. Use this tool to finalize code integration in your GitLab project workflow.
Instructions
核准 Merge Request
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| mr_iid | Yes |
Implementation Reference
- src/gitlab_mcp/server.py:362-375 (handler)The MCP tool handler that receives the request and calls the GitLab client to approve a merge request.
def approve_merge_request(project_id: int | str, mr_iid: int) -> str: """核准 Merge Request Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID """ try: client = get_client() client.approve_merge_request(project_id, mr_iid) return f"✓ MR !{mr_iid} 已核准" except GitLabAPIError as e: return f"核准 MR 失敗: {str(e)}" - src/gitlab_mcp/gitlab_client.py:252-255 (handler)The underlying API client method that performs the actual HTTP POST request to GitLab to approve a merge request.
def approve_merge_request(self, project_id: int | str, mr_iid: int) -> dict: """POST /projects/:id/merge_requests/:iid/approve""" pid = self._resolve_project_id(project_id) return self._post_json(f"/projects/{pid}/merge_requests/{mr_iid}/approve")