Skip to main content
Glama

update_merge_request

Modify an existing GitLab merge request by updating its title, description, state, target branch, labels, assignees, milestone, or source branch removal setting.

Instructions

Update an existing merge request in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or URL-encoded path
merge_request_iidYesMerge request internal ID
titleNoNew merge request title
descriptionNoNew merge request description
state_eventNoChange merge request state
target_branchNoNew target branch
labelsNoArray of label names
assignee_idsNoArray of user IDs to assign
milestone_idNoMilestone ID to assign
remove_source_branchNoRemove source branch when merged

Implementation Reference

  • The implementation of the update_merge_request API function, which calls the GitLab PUT endpoint to update a merge request.
    export async function updateMergeRequest(
      projectId: string,
      mergeRequestIid: number,
      options: {
        title?: string;
        description?: string;
        state_event?: "close" | "reopen";
        target_branch?: string;
        labels?: string[];
        assignee_ids?: number[];
        milestone_id?: number;
        remove_source_branch?: boolean;
      }
    ): 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}`;
    
      const mergeRequest = await gitlabPut<GitLabMergeRequest>(endpoint, {
        ...options,
        labels: options.labels?.join(",")
      });
    
      return GitLabMergeRequestSchema.parse(mergeRequest);
    }
  • Input validation schema for the update_merge_request tool.
    export const UpdateMergeRequestSchema = z.object({
      project_id: z.string().describe("Project ID or URL-encoded path"),
      merge_request_iid: z.number().describe("Merge request internal ID"),
      title: z.string().optional().describe("New merge request title"),
      description: z.string().optional().describe("New merge request description"),
      state_event: z.enum(["close", "reopen"]).optional().describe("Change merge request state"),
      target_branch: z.string().optional().describe("New target branch"),
      labels: z.array(z.string()).optional().describe("Array of label names"),
      assignee_ids: z.array(z.number()).optional().describe("Array of user IDs to assign"),
  • src/server.ts:425-430 (registration)
    Handler registration and execution logic for the update_merge_request tool within the main server loop.
    case "update_merge_request": {
      const args = UpdateMergeRequestSchema.parse(request.params.arguments);
      const { project_id, merge_request_iid, ...options } = args;
      const mergeRequest = await api.updateMergeRequest(project_id, merge_request_iid, options);
      return { content: [{ type: "text", text: JSON.stringify(mergeRequest, null, 2) }] };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states this is an update operation, implying mutation, but doesn't cover critical aspects like required permissions, whether changes are reversible, rate limits, or what happens to unspecified fields. This leaves significant gaps for a mutation tool.

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, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly without unnecessary elaboration.

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?

Given the complexity of a 10-parameter mutation tool with no annotations and no output schema, the description is inadequate. It lacks information on behavioral traits, usage context, and expected outcomes, leaving the agent with insufficient guidance to use the tool effectively beyond basic parameter passing.

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?

The schema description coverage is 100%, with all parameters well-documented in the schema itself. The description adds no additional parameter semantics beyond implying that updates apply to an existing merge request, which is already clear from the tool name and schema. This meets the baseline for high schema coverage.

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 ('Update') and resource ('an existing merge request in a GitLab project'), making the purpose immediately understandable. However, it doesn't distinguish this tool from similar sibling tools like 'update_issue' or 'update_milestone' beyond the resource type, missing explicit differentiation.

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., needing an existing merge request), compare it to 'create_merge_request' for initial creation, or specify scenarios where updates are appropriate versus other operations like commenting or merging.

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