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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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,
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool creates a note, implying a write operation, but doesn't disclose behavioral traits such as required permissions, rate limits, whether the note is editable/deletable, or how it interacts with the MR workflow. The description adds minimal context beyond the basic action.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the main purpose stated first followed by parameter details in a structured format. Every sentence earns its place, though the parameter explanations could be slightly more detailed without sacrificing conciseness.

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 the tool's complexity (a write operation with 3 parameters), lack of annotations, and presence of an output schema, the description is moderately complete. It covers the basic action and parameters but lacks behavioral context and usage guidelines. The output schema likely handles return values, so the description doesn't need to explain those.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It provides brief explanations for each parameter (e.g., '專案 ID 或路徑' for project_id, '留言內容(支援 Markdown)' for body), adding meaning beyond the bare schema. However, it doesn't fully detail constraints, formats, or examples, leaving gaps in parameter understanding.

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 action ('新增' meaning 'add/create') and resource ('Merge Request 留言' meaning 'Merge Request note/comment'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_merge_request_notes' or 'update_merge_request', which would require a more precise distinction.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing an existing merge request), exclusions, or comparisons to sibling tools like 'list_merge_request_notes' for reading notes or 'update_merge_request' for modifying MR details.

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