Skip to main content
Glama

create_merge_request_thread

Start a review thread on a GitLab merge request by anchoring comments to a specific diff line, file, or image position. Enables location-specific discussion directly on the code.

Instructions

Create a new thread on a merge request. Use this to start a review thread on a merge request; use create_merge_request_note for an unthreaded note and create_merge_request_discussion_note to reply to an existing thread. The operation creates remote review content, requires note permission, and returns the discussion or a position/permission/validation error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesThe content of the thread
positionNoPosition when creating a diff note
created_atNoDate the thread was created at (ISO 8601 format)
project_idYesProject ID or complete URL-encoded path to project
merge_request_iidYesThe IID of a merge request

Schema Changelog

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

  1. Addedv2.1.18
  2. Removedv2.1.14
  3. Addedv2.1.11
  4. Removedv2.1.10
  5. Changed8 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / position / additionalProperties
      Removed value: -false
    • changedInput schema / properties / position / properties / height / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
    • changedInput schema / properties / position / properties / line_range / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "description": "Line range for multiline comments on GitLab merge request diffs. VALIDATION RULES: 1) line_code is critical for GitLab API success, 2) start/end must have consistent types, 3) line numbers must form valid range, 4) get line_code from GitLab diff API, never generate manually.",
      -    "properties": {
      -      "end": {
      -        "additionalProperties": false,
      -        "description": "End line position for multiline comment range. MUST specify either old_line OR new_line (or both for context), never neither. Range must be valid (end >= start).",
      -        "properties": {
      -          "line_code": {
      -            "description": "CRITICAL: Line identifier in format '{file_path_sha1_hash}_{old_line_number}_{new_line_number}'. USUALLY REQUIRED for GitLab diff comments despite being optional in schema. Example: 'a1b2c3d4e5f6_12_17'. Must be from same file as start.line_code.",
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "new_line": {
      -            "description": "Line number in modified file (after changes). REQUIRED when type='new', NULL when type='old' (for purely deleted lines), can be present for context lines. MUST be >= start.new_line if both specified.",
      -            "type": [
      -              "number",
      -              "null"
      -            ]
      -          },
      -          "old_line": {
      -            "description": "Line number in original file (before changes). REQUIRED when type='old', NULL when type='new' (for purely added lines), can be present for context lines. MUST be >= start.old_line if both specified.",
      -            "type": [
      -              "number",
      -              "null"
      -            ]
      -          },
      -          "type": {
      -            "anyOf": [
      -              {
      -                "enum": [
      -                  "new",
      -                  "old",
      -                  "expanded",
      -                  "logic",
      -                  "style"
      -                ],
      -                "type": "string"
      -              },
      -              {
      -                "type": "null"
      -              }
      -            ],
      -            "description": "Line type: 'old' = deleted/original line, 'new' = added/modified line, null = unchanged context. SHOULD MATCH start.type for consistent ranges (don't mix old/new types)."
      -          }
      -        },
      -        "type": "object"
      -      },
      -      "start": {
      -        "additionalProperties": false,
      -        "description": "Start line position for multiline comment range. MUST specify either old_line OR new_line (or both for context), never neither.",
      -        "properties": {
      -          "line_code": {
      -            "description": "CRITICAL: Line identifier in format '{file_path_sha1_hash}_{old_line_number}_{new_line_number}'. USUALLY REQUIRED for GitLab diff comments despite being optional in schema. Example: 'a1b2c3d4e5f6_10_15'. Get this from GitLab diff API response, never fabricate.",
      -            "type": [
      -              "string",
      -              "null"
      -            ]
      -          },
      -          "new_line": {
      -            "description": "Line number in modified file (after changes). REQUIRED when type='new', NULL when type='old' (for purely deleted lines), can be present for context lines.",
      -            "type": [
      -              "number",
      -              "null"
      -            ]
      -          },
      -          "old_line": {
      -            "description": "Line number in original file (before changes). REQUIRED when type='old', NULL when type='new' (for purely added lines), can be present for context lines.",
      -            "type": [
      -              "number",
      -              "null"
      -            ]
      -          },
      -          "type": {
      -            "anyOf": [
      -              {
      -                "enum": [
      -                  "new",
      -                  "old",
      -                  "expanded",
      -                  "logic",
      -                  "style"
      -                ],
      -                "type": "string"
      -              },
      -              {
      -                "type": "null"
      -              }
      -            ],
      -            "description": "Line type: 'old' = deleted/original line, 'new' = added/modified line, null = unchanged context. MUST match the line_code format and old_line/new_line values."
      -          }
      -        },
      -        "type": "object"
      -      }
      -    },
      -    "required": [
      -      "start",
      -      "end"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "description": "Line range for multiline comments on GitLab merge request diffs. VALIDATION RULES: 1) line_code is critical for GitLab API success, 2) start/end must have consistent types, 3) line numbers must form valid range, 4) get line_code from GitLab diff API, never generate manually.",
      +    "properties": {
      +      "end": {
      +        "description": "End line position for multiline comment range. MUST specify either old_line OR new_line (or both for context), never neither. Range must be valid (end >= start).",
      +        "properties": {
      +          "line_code": {
      +            "description": "CRITICAL: Line identifier in format '{file_path_sha1_hash}_{old_line_number}_{new_line_number}'. USUALLY REQUIRED for GitLab diff comments despite being optional in schema. Example: 'a1b2c3d4e5f6_12_17'. Must be from same file as start.line_code.",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "new_line": {
      +            "description": "Line number in modified file (after changes). REQUIRED when type='new', NULL when type='old' (for purely deleted lines), can be present for context lines. MUST be >= start.new_line if both specified.",
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "old_line": {
      +            "description": "Line number in original file (before changes). REQUIRED when type='old', NULL when type='new' (for purely added lines), can be present for context lines. MUST be >= start.old_line if both specified.",
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "type": {
      +            "anyOf": [
      +              {
      +                "enum": [
      +                  "new",
      +                  "old",
      +                  "expanded",
      +                  "logic",
      +                  "style"
      +                ],
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Line type: 'old' = deleted/original line, 'new' = added/modified line, null = unchanged context. SHOULD MATCH start.type for consistent ranges (don't mix old/new types)."
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "start": {
      +        "description": "Start line position for multiline comment range. MUST specify either old_line OR new_line (or both for context), never neither.",
      +        "properties": {
      +          "line_code": {
      +            "description": "CRITICAL: Line identifier in format '{file_path_sha1_hash}_{old_line_number}_{new_line_number}'. USUALLY REQUIRED for GitLab diff comments despite being optional in schema. Example: 'a1b2c3d4e5f6_10_15'. Get this from GitLab diff API response, never fabricate.",
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "new_line": {
      +            "description": "Line number in modified file (after changes). REQUIRED when type='new', NULL when type='old' (for purely deleted lines), can be present for context lines.",
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "old_line": {
      +            "description": "Line number in original file (before changes). REQUIRED when type='old', NULL when type='new' (for purely added lines), can be present for context lines.",
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "type": {
      +            "anyOf": [
      +              {
      +                "enum": [
      +                  "new",
      +                  "old",
      +                  "expanded",
      +                  "logic",
      +                  "style"
      +                ],
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Line type: 'old' = deleted/original line, 'new' = added/modified line, null = unchanged context. MUST match the line_code format and old_line/new_line values."
      +          }
      +        },
      +        "type": "object"
      +      }
      +    },
      +    "required": [
      +      "start",
      +      "end"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / position / properties / width / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
    • changedInput schema / properties / position / properties / x / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
    • changedInput schema / properties / position / properties / y / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "body"
      -]New value: +[
      +  "body",
      +  "project_id",
      +  "merge_request_iid"
      +]
  6. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

The annotations only provide `openWorldHint: true`, so the description carries the burden of behavioral disclosure. It states that the operation creates remote review content, requires note permission, and returns the discussion or a position/permission/validation error. This gives useful side-effect and failure-mode context, though it does not cover details like idempotency or rate limits.

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 three sentences with no filler: purpose first, sibling routing second, and behavioral disclosure third. Every sentence earns its place and the structure supports quick scanning by an agent.

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

Completeness4/5

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

The tool has a complex nested `position` schema and no output schema, so the description reasonably covers the action, permission requirement, and return/error behavior. A minor gap is that it does not mention that `position` is optional for MR-level discussions, though this is inferable from the required field list in the schema.

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 fully documents the parameters, including the nested `position` object. The description adds no per-parameter meaning beyond what the schema already provides, which is acceptable at the baseline for full coverage.

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 clearly states a specific action ('Create a new thread') and a specific resource ('on a merge request'). It also differentiates itself from the sibling tools `create_merge_request_note` and `create_merge_request_discussion_note`, so an agent can select it over alternatives without opening the schema.

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 explicitly says when to use this tool: to start a review thread on a merge request. It also names the sibling tools for the alternative cases — unthreaded notes and replies to existing threads — leaving no ambiguity about routing.

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