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
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | ||
| body | No | ||
| labels | No | ||
| milestone | No | ||
| owner | Yes | ||
| repo | Yes | ||
| title | Yes |
Implementation Reference
- src/tools/issues.ts:135-179 (handler)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'); }
- src/utils/validation.ts:91-97 (schema)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(), });
- src/server.ts:1215-1217 (registration)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, },