Skip to main content
Glama

GitLab MCP Code Review

by ffpy

add_merge_request_comment

Add comments to GitLab merge requests for code review feedback, discussion points, or general observations during the review process.

Instructions

Add a general comment to a merge request. Args: project_id: The GitLab project ID or URL-encoded path merge_request_iid: The merge request IID (project-specific ID) body: The comment text Returns: Dict containing the created comment information

Input Schema

NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes
bodyYes

Input Schema (JSON Schema)

{ "properties": { "body": { "title": "Body", "type": "string" }, "merge_request_iid": { "title": "Merge Request Iid", "type": "string" }, "project_id": { "title": "Project Id", "type": "string" } }, "required": [ "project_id", "merge_request_iid", "body" ], "type": "object" }

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers and implements the 'add_merge_request_comment' tool. It fetches the project and merge request using the GitLab client from context, creates a new note with the provided body, and returns the note as a dictionary.
    @mcp.tool() def add_merge_request_comment(ctx: Context, project_id: str, merge_request_iid: str, body: str) -> Dict[str, Any]: """ Add a general comment to a merge request. Args: project_id: The GitLab project ID or URL-encoded path merge_request_iid: The merge request IID (project-specific ID) body: The comment text Returns: Dict containing the created comment information """ gl = ctx.request_context.lifespan_context project = gl.projects.get(project_id) mr = project.mergerequests.get(merge_request_iid) note = mr.notes.create({'body': body}) return note.asdict()
  • server.py:197-197 (registration)
    The @mcp.tool() decorator registers the 'add_merge_request_comment' function as an MCP tool.
    @mcp.tool()

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/ffpy/gitlab-mcp-code-review'

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