Skip to main content
Glama

GitLab MCP Code Review

by ffpy

delete_merge_request_discussion

Remove a specific discussion from a GitLab merge request to clean up resolved conversations or outdated comments during code review.

Instructions

Delete 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 delete Returns: Dict containing the status of the deletion

Input Schema

NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes
discussion_idYes

Input Schema (JSON Schema)

{ "properties": { "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" ], "type": "object" }

Implementation Reference

  • The handler function for the 'delete_merge_request_discussion' tool, decorated with @mcp.tool(). It retrieves the discussion and deletes its first note, which deletes the discussion if it's the only note.
    @mcp.tool() def delete_merge_request_discussion(ctx: Context, project_id: str, merge_request_iid: str, discussion_id: str) -> Dict[str, Any]: """ Delete 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 delete Returns: Dict containing the status of the deletion """ 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) # To delete a discussion, we delete its first note. # If the discussion only has one note, the discussion will be deleted. if discussion.notes: first_note_id = discussion.notes[0]['id'] discussion.notes.delete(first_note_id) return {"status": "success", "deleted_note_id": first_note_id} return {"status": "failed", "message": "Discussion has no notes to delete."}

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