Skip to main content
Glama

gitlab_merge_mr

DestructiveIdempotent

Merges a GitLab merge request only after verifying its merge status, returning cannot_merge when conflicts or required pipelines block the merge.

Instructions

Perform the actual merge if GitLab reports the MR can be merged.

Destructive: writes to the target branch. Checks merge_status first and returns status='cannot_merge' if conflicts exist or pipelines are required.

Examples: - "Merge !42" → mr_iid=42 - Don't call without checking gitlab_get_merge_request first when you suspect conflicts.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mr_iid": "<mr_iid>",
      "project_path": "<project_path>"
    },
    "name": "gitlab_merge_mr"
  }
}

Input Schema

NameRequiredDescriptionDefault
mr_iidYesMerge request IID to merge.
project_pathYesGitLab project path (e.g. 'my-org/my-repo'). Required by default. For legacy deployments only, set GITLAB_ALLOW_DEFAULT_PROJECT=true to use GITLAB_PROJECT_PATH when omitted.

Output Schema

NameRequiredDescriptionDefault
iidNo
hintNo
stateNo
titleNo
statusNo
web_urlNo
merge_statusNo
has_conflictsNo
source_branchNo
target_branchNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.5.5
    • removedInput schema / properties / project_path / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / project_path / default
      Removed value: -null
    • changedInput schema / properties / project_path / description
      Previous value: -"GitLab project path (e.g. 'my-org/my-repo'). When omitted, the default from GITLAB_PROJECT_PATH env var is used."New value: +"GitLab project path (e.g. 'my-org/my-repo'). Required by default. For legacy deployments only, set GITLAB_ALLOW_DEFAULT_PROJECT=true to use GITLAB_PROJECT_PATH when omitted."
    • addedInput schema / properties / project_path / minLength
      Added value: +1
    • addedInput schema / properties / project_path / type
      Added value: +"string"
    • changedInput schema / required
      Previous value: -[
      -  "mr_iid"
      -]New value: +[
      +  "mr_iid",
      +  "project_path"
      +]
  2. First observedv0.5.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, so the bar is lower, yet the description adds real context: it writes to the target branch, performs a pre-flight merge_status check, and specifies the returned status value on refusal. This is consistent with the destructive annotation rather than merely restating it.

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?

Front-loads the destructive warning and the success precondition before anything else, and every clause carries information. Minor redundancy between the 'cannot_merge' behavior line and the closing caution about checking merge status first prevents a top score.

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

Completeness5/5

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

A two-parameter, destructive mutation with full schema coverage, complete annotations, and an output schema — the description covers the one thing annotations cannot (the merge_status precondition and refusal return) and need not explain return values. Nothing required for a correct invocation is missing.

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?

Schema coverage is 100%, so the baseline is 3; the description earns an increment by mapping GitLab's '!42' notation to mr_iid=42 via a concrete example. It adds nothing about project_path, but that parameter is fully documented in the schema, so no gap remains.

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?

States a specific verb and resource ('Perform the actual merge') and scopes it to MRs GitLab reports as mergeable. The phrasing 'the actual merge' implicitly separates it from gitlab_create_merge_request and gitlab_get_merge_request, and it names the read-only sibling by name.

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?

Explicit when-to-use ('if GitLab reports the MR can be merged'), explicit failure conditions ('status=\'cannot_merge\' if conflicts exist or pipelines are required'), and an explicit prerequisite ('Don't call without checking gitlab_get_merge_request first when you suspect conflicts'). Routing versus the read/diagnostic siblings is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.