create_issue
Create a new issue in a GitLab project by specifying project ID, title, description, assignees, labels, and milestone. Streamline issue tracking and collaboration directly through the gitlab-mcp-server.
Instructions
Create a new issue in a GitLab project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee_ids | No | ||
| description | No | ||
| labels | No | ||
| milestone_id | No | ||
| project_id | No | ||
| title | No |
Implementation Reference
- src/index.ts:401-405 (handler)MCP tool handler in the switch statement that parses arguments, extracts project_id and options, calls gitlabApi.createIssue, and returns the JSON response.case "create_issue": { const args = CreateIssueSchema.parse(request.params.arguments); const { project_id, ...options } = args; const issue = await gitlabApi.createIssue(project_id, options); return { content: [{ type: "text", text: JSON.stringify(issue, null, 2) }] };
- src/schemas.ts:422-424 (schema)Zod schema for create_issue tool input: requires project_id and merges CreateIssueOptionsSchema (title, description, etc.). CreateIssueOptionsSchema defined lines 374-380.export const CreateIssueSchema = z.object({ project_id: z.string() }).merge(CreateIssueOptionsSchema);
- src/index.ts:138-142 (registration)Tool registration in ALL_TOOLS array, defining name, description, input schema, and readOnly flag.{ name: "create_issue", description: "Create a new issue in a GitLab project", inputSchema: createJsonSchema(CreateIssueSchema), readOnly: false
- src/gitlab-api.ts:688-718 (helper)GitLab API helper method that performs the POST request to create an issue, handles response and validation.async createIssue( projectId: string, options: z.infer<typeof CreateIssueOptionsSchema> ): Promise<GitLabIssue> { const response = await fetch( `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/issues`, { method: "POST", headers: { "Authorization": `Bearer ${this.token}`, "Content-Type": "application/json" }, body: JSON.stringify({ title: options.title, description: options.description, assignee_ids: options.assignee_ids, milestone_id: options.milestone_id, labels: options.labels?.join(',') }) } ); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `GitLab API error: ${response.statusText}` ); } return GitLabIssueSchema.parse(await response.json()); }