Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYes
mr_iidYes

Implementation Reference

  • 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)}"
  • 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")

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/snowild/gitlab-mcp'

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