Skip to main content
Glama

merge_merge_request

Destructive

Merges a reviewed GitLab merge request after checks pass, with options to squash commits, auto-merge when pipeline succeeds, or remove the source branch.

Instructions

Merge a merge request. Use this only after checking the merge request approval, conflict, and pipeline state; use approve_merge_request to approve rather than merge. The operation changes repository state and may squash commits, schedule auto-merge, or delete the source branch, so it requires merge permission and returns GitLab's merge result or a mergeability error. Pass sha from get_merge_request (sha or diff_refs.head_sha); GitLab 19.2+ groups may reject merges without it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shaNoSHA of the source-branch HEAD from get_merge_request (`sha` or `diff_refs.head_sha`). If provided, GitLab merges only when HEAD still matches. GitLab 19.2+ groups may require this (Require a commit SHA on the merge requests API).
squashNoSquash commits into a single commit when merging
auto_mergeNoIf true, the merge request merges when the pipeline succeeds.
project_idYesProject ID or complete URL-encoded path to project
merge_request_iidNoThe IID of a merge request
merge_commit_messageNoCustom merge commit message
squash_commit_messageNoCustom squash commit message
should_remove_source_branchNoRemove source branch after merge
merge_when_pipeline_succeedsNoIf true, the merge request merges when the pipeline succeeds. Deprecated in GitLab 17.11. Use `auto_merge` instead.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv2.1.52
    • addedInput schema / properties / sha
      Added value: +{
      +  "description": "SHA of the source-branch HEAD from get_merge_request (`sha` or `diff_refs.head_sha`). If provided, GitLab merges only when HEAD still matches. GitLab 19.2+ groups may require this (Require a commit SHA on the merge requests API).",
      +  "type": "string"
      +}
  2. Addedv2.1.45
  3. Removedv2.1.43
  4. Changed1 schema field changedv2.1.24
    • changedInput schema / properties / merge_when_pipeline_succeeds / description
      Previous value: -"If true, the merge request merges when the pipeline succeeds.in GitLab 17.11. Use"New value: +"If true, the merge request merges when the pipeline succeeds. Deprecated in GitLab 17.11. Use `auto_merge` instead."
  5. Addedv2.1.18
  6. Removedv2.1.14
  7. Addedv2.1.11
  8. Removedv2.1.10
  9. Changed2 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / required
      Added value: +[
      +  "project_id"
      +]
  10. First observedv1.0.0

TDQS

A5/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, but the description adds substantial concreteness: 'may squash commits, schedule auto-merge, or delete the source branch,' requires merge permission, and 'returns GitLab's merge result or a mergeability error.' It also discloses the GitLab version-specific `sha` requirement, which the annotation does not convey. There is no contradiction between description and annotations.

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 four dense sentences, each earning its place: purpose, usage conditions and alternative, side effects and permission, then the `sha` tip. No filler or redundancy; material is front-loaded with the core action first.

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?

For a destructive tool with 9 parameters and no output schema, the description covers the essential decision factors: preconditions (approval/conflict/pipeline checks), the alternative tool, behavioral consequences, permission requirements, return type (result or error), and a parameter-source hint. Nothing an agent needs to call this tool safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description enriches parameter understanding far beyond the schema. It tells the agent to source `sha` from `get_merge_request` (`sha` or `diff_refs.head_sha`), explains why GitLab 19.2+ groups may require it, and clarifies that `merge_when_pipeline_succeeds` is deprecated in favor of `auto_merge`. This is meaningful cross-parameter guidance the schema does not provide.

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 opens with 'Merge a merge request,' a clear verb+resource pairing. It explicitly distinguishes itself from `approve_merge_request`, telling agents to use that tool for approval instead, and names the state checks (approval, conflict, pipeline) that precede merging, making its scope unambiguous relative to the many merge-request siblings.

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?

It gives precise when-to-use guidance: 'Use this only after checking the merge request approval, conflict, and pipeline state' and explicitly routes to `approve_merge_request` for approvals. It also calls out the merge-permission prerequisite and instructs to pass `sha` from `get_merge_request`, covering both sequencing and alternatives.

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

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