mark_mr_as_draft
Mark a GitLab merge request as draft to indicate it's a work in progress and not ready for review.
Instructions
Mark a merge request as draft (work in progress, not ready for review)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID or path | |
| merge_request_iid | Yes | Merge request internal ID |
Implementation Reference
- src/handlers/merge-requests.ts:580-620 (handler)Core implementation of the mark_mr_as_draft tool: fetches the MR details, checks if already marked as draft (Draft: or WIP: prefix), and if not, updates the title by prefixing 'Draft: '.async markMRAsDraft(args: MarkMRAsDraftParams) { // First get the current MR to check its title const mr = (await this.client.get( `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${ args.merge_request_iid }` )) as GitLabMergeRequest; // Check if already a draft if (mr.title.startsWith("Draft: ") || mr.title.startsWith("WIP: ")) { return { content: [ { type: "text", text: JSON.stringify( { message: "Merge request is already marked as draft", ...mr }, null, 2 ), }, ], }; } // Update the title to add Draft: prefix const data = await this.client.put( `/projects/${encodeURIComponent(args.project_id)}/merge_requests/${ args.merge_request_iid }`, { title: `Draft: ${mr.title}` } ); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/tools/merge-requests.ts:621-639 (registration)Tool registration: defines the MCP tool object with name 'mark_mr_as_draft', description, and input JSON schema. Included in mergeRequestTools array imported for server tool listing.{ name: 'mark_mr_as_draft', description: 'Mark a merge request as draft (work in progress, not ready for review)', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Project ID or path', }, merge_request_iid: { type: 'number', description: 'Merge request internal ID', }, }, required: ['project_id', 'merge_request_iid'], }, },
- src/server.ts:247-250 (registration)Server dispatch: switch case in CallToolRequestSchema handler that routes calls to the tool to MergeRequestHandlers.markMRAsDraft method.case "mark_mr_as_draft": return await this.mergeRequestHandlers.markMRAsDraft( args as unknown as MarkMRAsDraftParams );
- src/types.ts:543-546 (schema)TypeScript type definition for the input parameters used by the handler and referenced in server dispatch.export interface MarkMRAsDraftParams { project_id: string; merge_request_iid: number; }