Skip to main content
Glama

create_merge_request_note

Add comments to GitLab merge requests to provide feedback, ask questions, or discuss code changes. Supports Markdown formatting for clear communication.

Instructions

新增 Merge Request 留言

Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID body: 留言內容(支援 Markdown)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
mr_iidYes
bodyYes

Implementation Reference

  • MCP tool handler that calls the GitLab client to add a note to a merge request.
    def create_merge_request_note(project_id: int | str, mr_iid: int,
                                  body: str) -> str:
        """新增 Merge Request 留言
    
        Args:
            project_id: 專案 ID 或路徑
            mr_iid: MR 的 IID
            body: 留言內容(支援 Markdown)
        """
        try:
            if not body or not body.strip():
                return "留言內容不能為空"
    
            client = get_client()
            note = client.create_merge_request_note(project_id, mr_iid, body)
            return f"✓ 留言已新增至 MR !{mr_iid}(留言 ID: {note['id']})"
        except GitLabAPIError as e:
            return f"新增留言失敗: {str(e)}"
  • GitLab client implementation that performs the actual API request to create a merge request note.
    def create_merge_request_note(
        self, project_id: int | str, mr_iid: int, body: str
    ) -> dict:
        """POST /projects/:id/merge_requests/:iid/notes"""
        pid = self._resolve_project_id(project_id)
        return self._post_json(
            f"/projects/{pid}/merge_requests/{mr_iid}/notes", data={"body": body}
        )
  • Registration of the 'create_merge_request_note' function as an MCP tool.
    @mcp.tool()
    def create_merge_request_note(project_id: int | str, mr_iid: int,

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