Skip to main content
Glama

gitlab_close_merge_request

Close a GitLab merge request without merging to abandon changes or defer work. The request can be reopened later if needed.

Instructions

Close merge request without merging Returns: Updated MR with closed state Use when: Abandoning changes, deferring work Note: Can be reopened later

Related tools:

  • gitlab_update_merge_request: Reopen or other updates

  • gitlab_merge_merge_request: Merge instead

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted
mr_iidYesMerge request number (IID - Internal ID) Type: integer Format: Project-specific MR number (without !) Required: Yes Examples: - 456 (for MR !456) - 7890 (for MR !7890) How to find: Look at MR URL or title - URL: https://gitlab.com/group/project/-/merge_requests/456 → use 456 - Title: "Add new feature (!456)" → use 456 Note: This is NOT the global MR ID

Implementation Reference

  • The core handler function that implements the gitlab_close_merge_request tool. It validates the project ID (auto-detecting from git if not provided), requires the MR IID argument, and delegates to the GitLabClient's close_merge_request method to perform the actual API call to close the merge request.
    def handle_close_merge_request(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle closing a merge request"""
        project_id = require_project_id(client, arguments)
        mr_iid = require_argument(arguments, "mr_iid")
        
        return client.close_merge_request(project_id, mr_iid)
  • Registration of the handler function in the TOOL_HANDLERS dictionary, which maps the tool name TOOL_CLOSE_MR ("gitlab_close_merge_request") to its handler. This dictionary is imported and used by server.py's call_tool handler.
    TOOL_UPDATE_MR: handle_update_merge_request,
    TOOL_CLOSE_MR: handle_close_merge_request,
    TOOL_MERGE_MR: handle_merge_merge_request,
  • MCP tool schema registration in the server's list_tools() method. Defines the tool name, description, and input schema (project_id optional string, mr_iid required integer). This makes the tool discoverable to MCP clients.
        name="gitlab_close_merge_request",
        description=desc.DESC_CLOSE_MR,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}
            },
            "required": ["mr_iid"]
        }
    ),
  • Constant definition for the tool name string, used consistently across handler registration, TOOL_HANDLERS mapping, and server tool list.
    TOOL_CLOSE_MR = "gitlab_close_merge_request"
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the action ('Close merge request without merging'), the result ('Returns: Updated MR with closed state'), and important behavioral traits ('Note: Can be reopened later'). However, it doesn't mention potential side effects like notifications, permission requirements, or error conditions, leaving some gaps 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 clear sections: action, return value, usage context, important note, and related tools. Every sentence adds value without redundancy, and information is front-loaded with the core purpose stated first. The bulleted related tools section is particularly helpful for navigation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description does well by explaining the action, return value, usage context, and reversibility. However, it doesn't cover potential error cases, authentication requirements, or rate limits. Given the complexity of closing a merge request, some additional context about permissions or side effects would make it more complete.

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?

The schema description coverage is 100%, with detailed explanations for both parameters (project_id and mr_iid). The description adds no parameter-specific information beyond what's already in the schema. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Close merge request without merging') and distinguishes it from sibling tools like 'gitlab_merge_merge_request' (for merging) and 'gitlab_update_merge_request' (for reopening or other updates). It explicitly identifies the resource (merge request) and the verb (close without merging), making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('Use when: Abandoning changes, deferring work') and clearly names alternatives ('gitlab_update_merge_request: Reopen or other updates' and 'gitlab_merge_merge_request: Merge instead'). This gives the agent clear context for selecting this tool over others in the sibling set.

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/Vijay-Duke/mcp-gitlab'

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