reply_to_merge_request_discussion
Respond to specific discussions in GitLab merge requests by adding comments that address code review feedback or questions from team members.
Instructions
Reply to a merge request discussion.
Args:
project_id: The GitLab project ID or URL-encoded path
merge_request_iid: The merge request IID (project-specific ID)
discussion_id: The ID of the discussion to reply to
body: The reply text
Returns:
Dict containing the created note information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| merge_request_iid | Yes | ||
| discussion_id | Yes | ||
| body | Yes |
Input Schema (JSON Schema)
{
"properties": {
"body": {
"title": "Body",
"type": "string"
},
"discussion_id": {
"title": "Discussion Id",
"type": "string"
},
"merge_request_iid": {
"title": "Merge Request Iid",
"type": "string"
},
"project_id": {
"title": "Project Id",
"type": "string"
}
},
"required": [
"project_id",
"merge_request_iid",
"discussion_id",
"body"
],
"type": "object"
}
Implementation Reference
- server.py:258-278 (handler)The handler function decorated with @mcp.tool() that implements the logic to reply to a merge request discussion by creating a note via GitLab API.@mcp.tool() def reply_to_merge_request_discussion(ctx: Context, project_id: str, merge_request_iid: str, discussion_id: str, body: str) -> Dict[str, Any]: """ Reply to a merge request discussion. Args: project_id: The GitLab project ID or URL-encoded path merge_request_iid: The merge request IID (project-specific ID) discussion_id: The ID of the discussion to reply to body: The reply text Returns: Dict containing the created note information """ gl = ctx.request_context.lifespan_context project = gl.projects.get(project_id) mr = project.mergerequests.get(merge_request_iid) discussion = mr.discussions.get(discussion_id) note = discussion.notes.create({'body': body}) return note.asdict()