Skip to main content
Glama

Merge Merge Request Tool

merge_merge_request_tool

Merge a GitLab merge request only when the source branch head still matches a required commit SHA, or schedule it to merge once the pipeline succeeds.

Instructions

Merge a merge request, or set it to merge when its pipeline succeeds.

sha is required and must be the full commit ID of the source branch head (the MR's "sha" field): GitLab merges only if the head is still that commit, so nothing pushed after review can slip in. A draft, a conflict, a closed MR or a moved head is refused without merging. Check CI first with get_mr_pipelines.

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": {
      "project_id": "<project_id>",
      "merge_request_iid": "<merge_request_iid>",
      "sha": "<sha>"
    },
    "name": "merge_merge_request_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
shaYesFull commit ID the source branch head must be
squashNoSquash commits on merge (omit to keep the MR's setting)
project_idYesProject ID or path
merge_request_iidYesMerge request internal ID
should_remove_source_branchNoRemove the source branch (omit to keep the MR's setting)
merge_when_pipeline_succeedsNoMerge once the head pipeline passes (default: false)

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.8.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and discloses critical behavior: the atomic merge semantics tied to the sha parameter, the safety guarantee that nothing pushed after review can slip in, and the exact refusal conditions. It stops short of mentioning permission requirements or the irreversible nature of merging, but the core behavioral traits are well covered.

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 tightly structured: purpose first, then the key sha requirement with rationale, then refusal conditions, and finally a pre-check recommendation. Every sentence contributes essential information with no redundancy, and the ordering is logical for an agent deciding how to invoke the tool.

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?

Given that the tool has an output schema and full schema descriptions, the description need not explain return values. It adequately covers the tool’s complexity by explaining atomic merge behavior, refusal scenarios, and a pre-check step. It could be more complete by noting permission requirements or side effects like closing the MR, but the essential context is present.

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, but the description adds meaning beyond the schema for the critical sha parameter: it explains that the full commit ID ensures GitLab merges only if the source branch head is still that commit, preventing sneaky pushes. It also hints at the merge_when_pipeline_succeeds mode, adding value beyond the schema’s field descriptions.

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 starts with a specific verb and resource: 'Merge a merge request, or set it to merge when its pipeline succeeds.' It clearly distinguishes the two modes of operation and names a sibling tool (get_mr_pipelines) for CI checks, leaving no ambiguity about its function.

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

Usage Guidelines4/5

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

The description explicitly advises checking CI first with get_mr_pipelines and lists conditions under which merging is refused (draft, conflict, closed MR, moved head), which implicitly tells the agent when not to expect success. It does not outline alternatives for the merge operation itself (there are none among siblings), but the pre-check guidance and refusal conditions provide clear contextual direction.

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