Skip to main content
Glama

merge_merge_request

Destructive

Merge a GitLab merge request after verifying approval, conflicts, and pipeline status. Optionally squash commits, auto-merge on pipeline success, 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
jmespathNoOptional JMESPath expression filtering the JSON result before return.
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.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. 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"
      +}
  3. Addedv2.1.45
  4. Removedv2.1.43
  5. 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."
  6. Addedv2.1.18
  7. Removedv2.1.14
  8. Addedv2.1.11
  9. Removedv2.1.10
  10. Changed2 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / required
      Added value: +[
      +  "project_id"
      +]
  11. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag openWorldHint and destructiveHint, but the description goes further: it explains the operation changes repository state, may squash commits, schedule auto-merge, or delete the source branch, requires merge permission, and returns a merge result or mergeability error. This goes well beyond the annotations and provides actionable behavioral context about side effects and permissions.

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?

The description is not extremely short but every sentence contributes: purpose, usage condition, side effects, permission, SHA guidance. It is front-loaded with the core purpose and conditional usage. There is no redundant content, though it could be slightly tighter without losing meaning.

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, open-world tool with 10 parameters and no output schema, the description covers all essential aspects: when to use, side effects, permission requirement, error behavior, and the critical SHA parameter guidance. Nothing an agent needs to call it correctly is missing, given the schema already details each parameter.

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 schema documents all parameters. The description adds extra semantic value by explicitly instructing to pass `sha` from get_merge_request and warning about GitLab 19.2+ groups, which is not fully in the schema. This is helpful cross-tool wiring, though the description does not add much beyond that because the schema already describes each parameter.

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 states clearly that the tool merges a merge request, and explicitly differentiates it from approve_merge_request, which is the relevant sibling. The verb 'merge' plus the resource 'merge request' is specific and unambiguous, so an agent can immediately distinguish this from sibling operations like approval or update.

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?

The description specifies when to use (only after checking approval, conflict, and pipeline state) and when not to (use approve_merge_request for approval). It also names the alternative tool explicitly. This gives an agent clear decision logic for tool selection, which is more than typical guidance.

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

Deploy Server

Other Tools