Skip to main content
Glama

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
NameRequiredDescriptionDefault
assignee_idsNo
descriptionNo
labelsNo
milestone_idNo
project_idNo
titleNo

Implementation Reference

  • 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) }] };
  • 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
  • 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());
    }

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/yoda-digital/mcp-gitlab-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server