Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

create_issue

Create new issues in GitLab projects by specifying project ID, title, description, labels, assignees, and milestones to track development tasks.

Instructions

Create a new issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
titleYesIssue title
descriptionNoIssue description
labelsNoComma-separated list of labels
assignee_idsNoArray of user IDs to assign
milestone_idNoMilestone ID

Implementation Reference

  • The main handler function that executes the create_issue tool by constructing the request data and calling the GitLab API to create a new issue in the specified project.
    async createIssue(args: CreateIssueParams) {
      const requestData: any = {
        title: args.title,
      };
    
      if (args.description) requestData.description = args.description;
      if (args.labels) requestData.labels = args.labels;
      if (args.assignee_ids) requestData.assignee_ids = args.assignee_ids;
      if (args.milestone_id) requestData.milestone_id = args.milestone_id;
    
      const data = await this.client.post(`/projects/${encodeURIComponent(args.project_id)}/issues`, requestData);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • src/server.ts:171-174 (registration)
    Registers the create_issue tool handler by dispatching tool calls in the MCP server's CallToolRequestSchema handler via a switch statement.
    case "create_issue":
      return await this.issueHandlers.createIssue(
        args as unknown as CreateIssueParams
      );
  • Defines the input schema for the create_issue tool, specifying parameters, types, descriptions, and required fields for validation.
    inputSchema: {
      type: 'object',
      properties: {
        project_id: {
          type: 'string',
          description: 'Project ID or path',
        },
        title: {
          type: 'string',
          description: 'Issue title',
        },
        description: {
          type: 'string',
          description: 'Issue description',
        },
        labels: {
          type: 'string',
          description: 'Comma-separated list of labels',
        },
        assignee_ids: {
          type: 'array',
          items: { type: 'number' },
          description: 'Array of user IDs to assign',
        },
        milestone_id: {
          type: 'number',
          description: 'Milestone ID',
        },
      },
      required: ['project_id', 'title'],
    },
  • Registers the create_issue tool in the issueTools array, which is used by the MCP server to list available tools.
    {
      name: 'create_issue',
      description: 'Create a new issue',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          title: {
            type: 'string',
            description: 'Issue title',
          },
          description: {
            type: 'string',
            description: 'Issue description',
          },
          labels: {
            type: 'string',
            description: 'Comma-separated list of labels',
          },
          assignee_ids: {
            type: 'array',
            items: { type: 'number' },
            description: 'Array of user IDs to assign',
          },
          milestone_id: {
            type: 'number',
            description: 'Milestone ID',
          },
        },
        required: ['project_id', 'title'],
      },
    },
  • TypeScript interface defining the parameters for the create_issue handler, used for type checking.
    export interface CreateIssueParams {
      project_id: string;
      title: string;
      description?: string;
      labels?: string;
      assignee_ids?: number[];
      milestone_id?: number;
    }

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

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