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"

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