Skip to main content
Glama

merge_merge_request

Merge a GitLab merge request to integrate code changes into the target branch. Specify project, merge request ID, and optional settings like commit message or branch cleanup.

Instructions

Merge a merge request in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or URL-encoded path
merge_request_iidYesMerge request internal ID
merge_commit_messageNoCustom merge commit message
should_remove_source_branchNoRemove source branch after merge
merge_when_pipeline_succeedsNoMerge when pipeline succeeds
shaNoSHA that must match the source branch HEAD

Implementation Reference

  • The implementation of the mergeMergeRequest function which performs the API call to merge a merge request.
    export async function mergeMergeRequest(
      projectId: string,
      mergeRequestIid: number,
      options: {
        merge_commit_message?: string;
        should_remove_source_branch?: boolean;
        merge_when_pipeline_succeeds?: boolean;
        sha?: string;
      } = {}
    ): Promise<GitLabMergeRequest> {
      if (!projectId?.trim()) {
        throw new Error("Project ID is required");
      }
      if (!mergeRequestIid || mergeRequestIid < 1) {
        throw new Error("Valid merge request IID is required");
      }
    
      const endpoint = `/projects/${encodeProjectId(projectId)}/merge_requests/${mergeRequestIid}/merge`;
    
      const mergeRequest = await gitlabPut<GitLabMergeRequest>(endpoint, options);
      return GitLabMergeRequestSchema.parse(mergeRequest);
    }
  • The Zod schema definition for the input arguments of the merge_merge_request tool.
    export const MergeMergeRequestSchema = z.object({
      project_id: z.string().describe("Project ID or URL-encoded path"),
      merge_request_iid: z.number().describe("Merge request internal ID"),
      merge_commit_message: z.string().optional().describe("Custom merge commit message"),
      should_remove_source_branch: z.boolean().optional().describe("Remove source branch after merge"),
      merge_when_pipeline_succeeds: z.boolean().optional().describe("Merge when pipeline succeeds"),
      sha: z.string().optional().describe("SHA that must match the source branch HEAD")
    });
  • src/server.ts:200-204 (registration)
    Registration of the merge_merge_request tool in the server definition.
    {
      name: "merge_merge_request",
      description: "Merge a merge request in a GitLab project",
      inputSchema: zodToJsonSchema(MergeMergeRequestSchema)
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('merge') which implies a destructive/write operation, but doesn't disclose critical behavioral traits: whether it requires specific permissions, what happens on success/failure (e.g., branch deletion based on parameters), rate limits, or what the tool returns. For a mutation tool with zero annotation coverage, this is a significant gap.

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 a single, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a tool with well-documented parameters in the schema, and the information is front-loaded with the core action immediately clear.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after merging (e.g., branch status changes), what the tool returns, error conditions, or permissions required. Given the complexity of merging in Git (which can fail due to conflicts, pipeline status, etc.), the description should provide more context about the operation's behavior and outcomes.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema - it doesn't explain parameter interactions, default behaviors, or provide examples. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('merge') and resource ('a merge request in a GitLab project'), making the purpose immediately understandable. It distinguishes from siblings like 'update_merge_request' by specifying the merge action rather than general updates. However, it doesn't explicitly differentiate from other merge-related operations that might exist in a broader context.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., merge request must be in mergeable state), when not to use it (e.g., if conflicts exist), or how it differs from related tools like 'update_merge_request' which might have overlapping functionality. The agent must infer usage from the name alone.

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

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