Skip to main content
Glama

create_merge_request_thread

Start a review thread on a merge request to discuss code changes. Use it to anchor comments to specific lines or ranges.

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
jmespathNoOptional JMESPath expression filtering the JSON result before return.
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.

  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.62
    • changedInput schema / required
      Previous value: -[
      -  "body",
      -  "project_id",
      -  "merge_request_iid"
      -]New value: +[
      +  "project_id",
      +  "merge_request_iid",
      +  "body"
      +]
  3. Addedv2.1.18
  4. Removedv2.1.14
  5. Addedv2.1.11
  6. Removedv2.1.10
  7. 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"
      +]
  8. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations provide only openWorldHint=true, so the description carries most of the behavioral burden. It states that the operation 'creates remote review content,' requires note permission, and returns a discussion or error. This adds useful transparency about side effects and failure modes, beyond what openWorldHint implies.

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?

Three sentences, each earning its place: the first states the core action, the second distinguishes siblings, and the third covers behavior and errors. No filler or redundancy; the structure front-loads the purpose.

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?

Given the complex nested schema and openWorldHint annotation, the description covers purpose, alternatives, permissions, and expected return/error behavior. It does not explain how to construct a position object, but the schema covers that in depth, so the description is complete enough for correct invocation.

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% with rich descriptions on position, line_range, and required fields. The description itself adds no parameter-level meaning beyond the schema, so the baseline of 3 is appropriate.

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 uses a specific verb and resource: 'Create a new thread on a merge request.' It explicitly differentiates from siblings by naming create_merge_request_note for unthreaded notes and create_merge_request_discussion_note for replies, so an agent can immediately tell them apart.

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 gives explicit when-to-use guidance: 'Use this to start a review thread' and names the exact alternatives for other cases. It also mentions the permission requirement ('requires note permission'), which is essential context for deciding whether this is the right tool.

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