Skip to main content
Glama

update_merge_request

Modify merge request details including title, description, assignees, reviewers, target branch, or state to manage code review workflows in GitLab projects.

Instructions

更新 Merge Request

Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID title: 新標題 description: 新描述 state_event: 狀態變更(close 或 reopen) assignee_id: 新指派人 ID reviewer_ids: 審核者 ID 列表(逗號分隔) target_branch: 新目標分支

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
mr_iidYes
titleNo
descriptionNo
state_eventNo
assignee_idNo
reviewer_idsNo
target_branchNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool `update_merge_request` is defined in `server.py` and decorated with `@mcp.tool()`. It handles input validation and calls the `client.update_merge_request` method.
    def update_merge_request(project_id: int | str, mr_iid: int,
                             title: str = None, description: str = None,
                             state_event: str = None, assignee_id: int = None,
                             reviewer_ids: str = None, target_branch: str = None) -> str:
        """更新 Merge Request
    
        Args:
            project_id: 專案 ID 或路徑
            mr_iid: MR 的 IID
            title: 新標題
            description: 新描述
            state_event: 狀態變更(close 或 reopen)
            assignee_id: 新指派人 ID
            reviewer_ids: 審核者 ID 列表(逗號分隔)
            target_branch: 新目標分支
        """
        try:
            data = {}
            if title is not None:
                data["title"] = title
            if description is not None:
                data["description"] = description
            if state_event is not None:
                data["state_event"] = state_event
            if assignee_id is not None:
                data["assignee_id"] = assignee_id
            if target_branch is not None:
                data["target_branch"] = target_branch
            if reviewer_ids is not None:
                try:
                    data["reviewer_ids"] = [int(x.strip()) for x in reviewer_ids.split(",")]
                except ValueError:
                    return "reviewer_ids 格式錯誤"
    
            if not data:
                return "請至少提供一個要更新的欄位"
    
            v = GitLabValidator.validate_merge_request_data(data, is_update=True)
            if not v.is_valid:
                return "驗證失敗:\n" + "\n".join(v.errors)
    
            client = get_client()
            mr = client.update_merge_request(project_id, mr_iid, **data)
            return f"✓ MR !{mr['iid']} 已更新 — {mr['title']} [{mr.get('state', '')}]"
        except GitLabAPIError as e:
            return f"更新 MR 失敗: {str(e)}"
  • The actual implementation that performs the API call to GitLab for updating a merge request.
    def update_merge_request(
        self, project_id: int | str, mr_iid: int, **kwargs
    ) -> dict:
        """PUT /projects/:id/merge_requests/:iid
    
        支援的 kwargs: title, description, state_event (close/reopen),
        assignee_id, reviewer_ids, target_branch
        """
        pid = self._resolve_project_id(project_id)
        # 僅包含非 None 值
        data = {k: v for k, v in kwargs.items() if v is not None}
        return self._put_json(f"/projects/{pid}/merge_requests/{mr_iid}", data=data)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation but doesn't mention permission requirements, whether changes are reversible, rate limits, or what happens when only some fields are provided. The description lacks crucial behavioral context for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately brief with a clear title and parameter explanations. However, the structure mixes Chinese and English ('Args:' header), and the parameter explanations could be more efficiently integrated. It's functional but not optimally structured for quick scanning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with 8 parameters, no annotations, but with an output schema present, the description is moderately complete. The parameter explanations are helpful, but it lacks behavioral context about permissions, side effects, and error conditions. The output schema reduces the need to describe return values, but more operational guidance would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description provides essential parameter semantics through the Chinese annotations in the Args section. It explains what each parameter represents (project ID/path, MR IID, new title, new description, etc.) and clarifies format details like '逗號分隔' (comma-separated) for reviewer_ids. This significantly compensates for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '更新 Merge Request' (update Merge Request), which is a specific verb+resource combination. It distinguishes from siblings like create_merge_request (creation) and get_merge_request (read), but doesn't explicitly differentiate from merge_merge_request (final merging) or other update-related tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing merge request), when to use create_merge_request instead, or how this differs from merge_merge_request. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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