Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

create-issue

Create a new issue in a GitHub repository by specifying the owner, repository name, title, and optional details like description, assignees, labels, or milestone.

Instructions

Create a new issue in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneesNo
bodyNo
labelsNo
milestoneNo
ownerYes
repoYes
titleYes

Implementation Reference

  • The main handler function that executes the create-issue tool logic: validates input using CreateIssueSchema, calls GitHub API to create the issue, and returns a formatted response.
    export async function createIssue(args: unknown): Promise<any> {
      const { owner, repo, title, body, assignees, milestone, labels } = CreateIssueSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().issues.create({
          owner,
          repo,
          title,
          body,
          assignees,
          milestone,
          labels,
        });
    
        return {
          id: data.id,
          number: data.number,
          title: data.title,
          state: data.state,
          assignees: data.assignees?.map((assignee) => ({
            login: assignee.login,
            id: assignee.id,
          })),
          user: data.user ? {
            login: data.user.login,
            id: data.user.id,
          } : null,
          labels: data.labels?.map((label) => 
            typeof label === 'string' ? label : {
              name: label.name,
              color: label.color,
            }
          ),
          milestone: data.milestone ? {
            number: data.milestone.number,
            title: data.milestone.title,
          } : null,
          created_at: data.created_at,
          updated_at: data.updated_at,
          body: data.body,
          url: data.html_url,
        };
      }, 'Failed to create issue');
    }
  • Zod schema for validating the input parameters of the create-issue tool.
    export const CreateIssueSchema = OwnerRepoSchema.extend({
      title: z.string().min(1, 'Issue title is required'),
      body: z.string().optional(),
      assignees: z.array(z.string()).optional(),
      milestone: z.number().optional(),
      labels: z.array(z.string()).optional(),
    });
  • Registration and dispatch of the create-issue tool in the main CallToolRequest handler switch statement.
    case 'create-issue':
      result = await createIssue(parsedArgs);
      break;
  • src/server.ts:586-622 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: 'create-issue',
      description: 'Create a new issue in a GitHub repository',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
          },
          repo: {
            type: 'string',
          },
          title: {
            type: 'string',
          },
          body: {
            type: 'string',
          },
          assignees: {
            type: 'array',
            items: {
              type: 'string',
            },
          },
          milestone: {
            type: 'number',
          },
          labels: {
            type: 'array',
            items: {
              type: 'string',
            },
          },
        },
        required: ['owner', 'repo', 'title'],
        additionalProperties: false,
      },

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/piyushgIITian/github-enterprice-mcp'

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