Skip to main content
Glama

Apply merge request suggestion

apply_merge_request_suggestion

Apply a specific GitLab code suggestion to a merge request after verifying it belongs to the project, is still applicable, and the MR head matches your reviewed version. Requires explicit acknowledgement to commit the change.

Instructions

Apply a single GitLab code suggestion by its suggestion ID. Performs preflight validation: confirms the suggestion belongs to the specified project/MR, is still applicable, has not already been applied, and that the MR head SHA matches the caller's expected value. Uses the Suggestions API at PUT /suggestions/:id/apply. Returns the suggestion state including applicable and applied flags. An explicit acknowledgement is required to apply. Note: GitLab's apply endpoint does not accept an expected-head parameter, so a TOCTOU race is possible between preflight and mutation; the server remains authoritative at mutation time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesGitLab project ID or full path such as group/project.
acknowledgeYesMust be true to confirm the suggestion should be applied.
suggestion_idYes
commit_messageNo
expected_head_shaYesThe MR head SHA the caller last reviewed. The tool rejects the mutation if the current MR head differs.
merge_request_iidYesProject-scoped internal ID.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYesGitLab response normalized for model use.
Behavior5/5

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

Exceptional disclosure beyond annotations: describes preflight checks (project/MR membership, applicability, applied state, head SHA match), flags the TOCTOU race condition, and notes the server remains authoritative at mutation time. No contradiction with readOnlyHint:false/destructiveHint:false.

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?

Well-structured with a clear lead sentence followed by high-value behavioral details. Dense but every sentence earns its place, though the TOCTOU note is lengthy, pushing the description toward the longer end.

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 mutation tool with side effects (*openWorldHint*: true), the description is remarkably complete: covers preconditions, error conditions, race-condition risk, and server authority. Return value is partially described (applicable/applied flags), supplemented by an output schema.

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?

Adds semantics beyond the 67% schema coverage by explaining why expected_head_sha and acknowledge matter (preflight validation and acknowledgement requirements). However, commit_message is entirely undiscussed, and no additional detail is given for merge_request_iid beyond the schema.

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?

Specific, actionable verb+resource: 'Apply a single GitLab code suggestion by its suggestion ID.' The word 'single' differentiates it from its batch sibling, and the description clearly scopes the tool's responsibility.

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?

Provides clear context: explicit acknowledgement required, preflight validation performed, and TOCTOU caveat disclosed. It stops short of explicitly naming batch_apply_merge_request_suggestions as an alternative, though 'single' implies when this tool is appropriate.

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

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