Skip to main content
Glama
ffpy

GitLab MCP Code Review

by ffpy

delete_merge_request_discussion

Remove a specific discussion thread from a GitLab merge request to clean up resolved comments or outdated feedback.

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

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes
discussion_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'delete_merge_request_discussion' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function deletes a merge request discussion by deleting its first note using the GitLab API.
    @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."}
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the action ('Delete') and return type ('Dict containing the status of the deletion'), but lacks critical details like required permissions, whether deletion is reversible, rate limits, or error conditions. This is a significant gap for a destructive operation.

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 well-structured with clear sections (Args, Returns) and uses bullet points for parameters, making it easy to scan. It's concise with no redundant information, though it could be slightly more front-loaded by emphasizing the destructive nature earlier.

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 (destructive operation with 3 parameters), no annotations, and an output schema (which covers return values), the description is moderately complete. It explains the action and parameters but lacks behavioral context like permissions or side effects, which is a notable gap for a deletion tool.

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 lists all three parameters with brief explanations (e.g., 'The GitLab project ID or URL-encoded path'), adding basic semantics beyond the schema's titles. However, it doesn't provide format examples, constraints, or how to obtain these IDs, leaving room for improvement.

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 ('Delete') and resource ('a merge request discussion'), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like 'resolve_merge_request_discussion' or 'reply_to_merge_request_discussion', which prevents a perfect score.

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 like 'resolve_merge_request_discussion' or 'add_merge_request_discussion'. The description only states what it does, not when it's appropriate or what prerequisites might be needed.

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

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