create_merge_request_thread
Add discussion threads to GitLab merge requests for code review, feedback, and collaboration on specific changes.
Instructions
Create a new thread on a merge request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID or complete URL-encoded path to project | |
| merge_request_iid | Yes | The IID of a merge request | |
| body | Yes | The content of the thread | |
| position | No | Position when creating a diff note | |
| created_at | No | Date the thread was created at (ISO 8601 format) |
Implementation Reference
- schemas.ts:1253-1260 (schema)Zod input schema for creating a new merge request thread/discussion, matching the tool 'create_merge_request_thread' parameters: project_id (inherited), merge_request_iid, body, optional position and created_at.export const CreateMergeRequestThreadSchema = ProjectParamsSchema.extend({ merge_request_iid: z.number().describe("The IID of a merge request"), body: z.string().describe("The content of the thread"), position: MergeRequestThreadPositionSchema.optional().describe( "Position when creating a diff note" ), created_at: z.string().optional().describe("Date the thread was created at (ISO 8601 format)"), });
- schemas.ts:1237-1250 (schema)Supporting schema for position parameter in diff notes when creating merge request threads.export const MergeRequestThreadPositionSchema = z.object({ base_sha: z.string().describe("Base commit SHA in the source branch"), head_sha: z.string().describe("SHA referencing HEAD of the source branch"), start_sha: z.string().describe("SHA referencing the start commit of the source branch"), position_type: z.enum(["text", "image", "file"]).describe("Type of position reference"), new_path: z.string().optional().describe("File path after change"), old_path: z.string().optional().describe("File path before change"), new_line: z.number().nullable().optional().describe("Line number after change"), old_line: z.number().nullable().optional().describe("Line number before change"), width: z.number().optional().describe("Width of the image (for image diffs)"), height: z.number().optional().describe("Height of the image (for image diffs)"), x: z.number().optional().describe("X coordinate on the image (for image diffs)"), y: z.number().optional().describe("Y coordinate on the image (for image diffs)"), });
- schemas.ts:1372-1372 (schema)Type export for the thread creation options, confirming schema usage in tool definition.export type CreateMergeRequestThreadOptions = z.infer<typeof CreateMergeRequestThreadSchema>;