Skip to main content
Glama

gitlab_update_merge_request

Modify merge request properties on GitLab by updating title, description, assignees, labels, state, or other fields. Use this tool to adjust MR details, add reviewers, close requests, or enable branch cleanup.

Instructions

Update merge request fields Returns: Updated MR object Use when: Modifying MR properties Can update: Title, description, assignees, labels, etc.

Examples:

  • Change title: {"title": "New title"}

  • Add reviewers: {"reviewer_ids": [123, 456]}

  • Close MR: {"state_event": "close"}

Related tools:

  • gitlab_get_merge_request: Check current state

  • gitlab_close_merge_request: Just close

  • gitlab_merge_merge_request: Merge MR

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allow_collaborationNoAllow commits from members Type: boolean Default: true Options: - true: Upstream members can push to fork branch - false: Only fork owner can push Use case: Let maintainers fix small issues directly
assignee_idNoSingle assignee user ID Type: integer Format: GitLab user ID (not username) Optional: Yes Examples: - 12345 (user's numeric ID) - null (to unassign) How to find: User profile URL or API Note: For multiple assignees, use assignee_ids instead
assignee_idsNoMultiple assignee user IDs Type: array of integers Format: List of GitLab user IDs Optional: Yes Examples: - [123, 456, 789] (assign to 3 users) - [123] (assign to 1 user) - [] (unassign all) Note: Premium feature for multiple assignees
descriptionNoDescription content Type: string Format: GitLab Flavored Markdown (GFM) Optional: Yes Features supported: - Mentions: @username - Issue references: #123 - MR references: !456 - Task lists: - [ ] Task - Code blocks with syntax highlighting - Tables, links, images Examples: 'Fixes #123 by updating validation logic. - [x] Add input validation - [ ] Update tests cc @teamlead for review'
discussion_lockedNoLock discussions Type: boolean Default: false Options: - true: Only project members can comment - false: Anyone can comment Use case: Prevent spam or off-topic comments
labelsNoLabels to apply Type: string Format: Comma-separated label names Optional: Yes Examples: - 'bug' (single label) - 'bug,priority::high' (multiple labels) - 'backend,needs-review,v2.0' (many labels) - '' (empty string to remove all labels) Note: Creates new labels if they don't exist
milestone_idNoMilestone ID Type: integer or null Format: Milestone's numeric ID Optional: Yes Examples: - 42 (assign to milestone with ID 42) - null (remove from milestone) How to find: Milestone page or API Note: Milestone must exist in the project
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
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
remove_source_branchNoDelete source branch after merge Type: boolean Default: false Options: - true: Delete branch after successful merge - false: Keep branch after merge Requirements: User must have permission to delete Use case: Automatic cleanup of feature branches
reviewer_idsNoReviewer user IDs Type: array of integers Format: List of GitLab user IDs Optional: Yes Examples: - [234, 567] (request review from 2 users) - [234] (single reviewer) - [] (remove all reviewers) Use case: Request code review from specific team members
squashNoSquash commits on merge Type: boolean Default: Follows project settings Options: - true: Combine all commits into one - false: Keep all commits - null: Use project default Use case: Clean commit history
state_eventNoState transition Type: string (enum) Options: - 'close': Close the issue/MR - 'reopen': Reopen a closed issue/MR Optional: Yes Examples: - 'close' (mark as closed) - 'reopen' (reactivate) Use case: Change issue/MR state without other updates
target_branchNoTarget branch for merge Type: string Required: Yes Format: Existing branch name Examples: - 'main' (merge into main) - 'develop' (merge into develop) - 'release/v2.0' (merge into release branch) Note: Branch must exist in the project
titleNoTitle text Type: string Required: Yes (for create/update operations) Max length: 255 characters Format: Plain text with emoji support Examples: - 'Fix login validation bug' - '🚀 Add new feature: Dark mode' - 'Update dependencies to latest versions' Note: Supports Unicode and special characters

Implementation Reference

  • Core execution logic for the gitlab_update_merge_request tool. Handles parameter extraction (project_id via detection or arg, required mr_iid), collects optional MR update fields (title, assignees, labels, etc.), and calls GitLabClient.update_merge_request to perform the API operation.
    def handle_update_merge_request(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle updating a merge request""" project_id = require_project_id(client, arguments) mr_iid = require_argument(arguments, "mr_iid") # Get all optional update fields update_fields = {} for field in ['title', 'description', 'assignee_id', 'assignee_ids', 'reviewer_ids', 'labels', 'milestone_id', 'state_event', 'remove_source_branch', 'squash', 'discussion_locked', 'allow_collaboration', 'target_branch']: if arguments and field in arguments: update_fields[field] = arguments[field] return client.update_merge_request(project_id, mr_iid, **update_fields)
  • Registration of the tool handler in the central TOOL_HANDLERS dictionary used by server.call_tool() to dispatch tool calls to the appropriate handler function.
    TOOL_UPDATE_MR: handle_update_merge_request,
  • MCP tool registration in @server.list_tools(), including name, description, and input schema validation defining parameters like mr_iid (required), project_id, title, assignees, labels, etc.
    types.Tool( name="gitlab_update_merge_request", description=desc.DESC_UPDATE_MR, inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID}, "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}, "title": {"type": "string", "description": desc.DESC_TITLE}, "description": {"type": "string", "description": desc.DESC_DESCRIPTION}, "assignee_id": {"type": "integer", "description": desc.DESC_ASSIGNEE_ID}, "assignee_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_ASSIGNEE_IDS}, "reviewer_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_REVIEWER_IDS}, "labels": {"type": "string", "description": desc.DESC_LABELS}, "milestone_id": {"type": "integer", "description": desc.DESC_MILESTONE_ID}, "state_event": {"type": "string", "description": desc.DESC_STATE_EVENT, "enum": ["close", "reopen"]}, "remove_source_branch": {"type": "boolean", "description": desc.DESC_REMOVE_SOURCE_BRANCH}, "squash": {"type": "boolean", "description": desc.DESC_SQUASH}, "discussion_locked": {"type": "boolean", "description": desc.DESC_DISCUSSION_LOCKED}, "allow_collaboration": {"type": "boolean", "description": desc.DESC_ALLOW_COLLABORATION}, "target_branch": {"type": "string", "description": desc.DESC_TARGET_BRANCH} }, "required": ["mr_iid"] } ),
  • Pydantic-style input schema for gitlab_update_merge_request tool, defining types, descriptions, and requirements for parameters like mr_iid (integer, required), project_id (string), title/description (string), assignee_ids/reviewer_ids (array of integers), labels (string), etc.
    inputSchema={ "type": "object", "properties": { "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID}, "mr_iid": {"type": "integer", "description": desc.DESC_MR_IID}, "title": {"type": "string", "description": desc.DESC_TITLE}, "description": {"type": "string", "description": desc.DESC_DESCRIPTION}, "assignee_id": {"type": "integer", "description": desc.DESC_ASSIGNEE_ID}, "assignee_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_ASSIGNEE_IDS}, "reviewer_ids": {"type": "array", "items": {"type": "integer"}, "description": desc.DESC_REVIEWER_IDS}, "labels": {"type": "string", "description": desc.DESC_LABELS}, "milestone_id": {"type": "integer", "description": desc.DESC_MILESTONE_ID}, "state_event": {"type": "string", "description": desc.DESC_STATE_EVENT, "enum": ["close", "reopen"]}, "remove_source_branch": {"type": "boolean", "description": desc.DESC_REMOVE_SOURCE_BRANCH}, "squash": {"type": "boolean", "description": desc.DESC_SQUASH}, "discussion_locked": {"type": "boolean", "description": desc.DESC_DISCUSSION_LOCKED}, "allow_collaboration": {"type": "boolean", "description": desc.DESC_ALLOW_COLLABORATION}, "target_branch": {"type": "string", "description": desc.DESC_TARGET_BRANCH} }, "required": ["mr_iid"] } ),
  • Constant definition for the tool name string, used consistently across handler registration, MCP tool listing, and testing.
    TOOL_UPDATE_MR = "gitlab_update_merge_request"

Other Tools

Related 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