Skip to main content
Glama
ffpy

GitLab MCP Code Review

by ffpy

add_merge_request_comment

Add a comment to a GitLab merge request to provide feedback, ask questions, or share information during code review.

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

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
merge_request_iidYes
bodyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function implementing the 'add_merge_request_comment' tool. It uses the GitLab client to retrieve the project and merge request, then creates a note (comment) on the merge request and returns its data. The @mcp.tool() decorator handles registration and schema inference from the signature and docstring.
    @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()
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It mentions the tool 'Adds' (implying a write operation) and returns 'Dict containing the created comment information', but doesn't disclose important traits like whether this requires specific permissions, if comments are editable/deletable, rate limits, or how it handles errors. The description doesn't contradict annotations (none exist), but fails to provide adequate behavioral transparency for a mutation tool.

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

Conciseness5/5

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

The description is efficiently structured with a clear purpose statement followed by parameter and return value sections. Every sentence adds value: the first states what the tool does, and the subsequent lines document inputs and outputs without redundancy. The formatting with 'Args:' and 'Returns:' headers enhances readability.

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 3 parameters with 0% schema coverage and no annotations, the description does well documenting parameters but lacks behavioral context for a mutation tool. The presence of an output schema means the description doesn't need to detail return values, but it should provide more guidance on usage and permissions. It's minimally adequate but has clear gaps in behavioral transparency.

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

Parameters4/5

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

The description adds meaningful context for all three parameters beyond the schema's 0% coverage. It explains that 'project_id' can be 'ID or URL-encoded path', clarifies 'merge_request_iid' as 'project-specific ID' (not global ID), and specifies 'body' as 'comment text'. This compensates well for the schema's lack of descriptions, though it doesn't provide format examples or constraints.

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 ('Add a general comment') and target resource ('to a merge request'), making the purpose immediately understandable. It distinguishes from siblings like 'add_merge_request_discussion' by specifying 'general comment' rather than discussion threads, though it doesn't explicitly contrast with other comment-related tools like 'reply_to_merge_request_discussion'.

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 when to choose 'add_merge_request_comment' over 'add_merge_request_discussion' or 'reply_to_merge_request_discussion', nor does it specify prerequisites like authentication or permissions needed to comment on merge requests.

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