create_issue
Generate a new issue in a GitHub repository by specifying owner, repo, title, and optional details like body, assignees, milestone, and labels.
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/index.ts:437-444 (handler)MCP tool handler for 'create_issue': parses input using _CreateIssueSchema, extracts parameters, calls issues.createIssue, and returns the result as JSON.case "create_issue": { const args = issues._CreateIssueSchema.parse(params.arguments); const { github_pat, owner, repo, ...options } = args; const issue = await issues.createIssue(github_pat, owner, repo, options); return { content: [{ type: "text", text: JSON.stringify(issue, null, 2) }], }; }
- src/operations/issues.ts:25-41 (schema)Zod schemas for create_issue: CreateIssueOptionsSchema (options), CreateIssueSchema (with owner/repo), _CreateIssueSchema (adds github_pat for internal use). Used for validation and JSON schema conversion.export const CreateIssueOptionsSchema = z.object({ title: z.string(), body: z.string().optional(), assignees: z.array(z.string()).optional(), milestone: z.number().optional(), labels: z.array(z.string()).optional(), }); export const CreateIssueSchema = z.object({ owner: z.string(), repo: z.string(), ...CreateIssueOptionsSchema.shape, }); export const _CreateIssueSchema = CreateIssueSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:103-107 (registration)Tool registration in ListTools response: defines name, description, and inputSchema based on CreateIssueSchema.{ name: "create_issue", description: "Create a new issue in a GitHub repository", inputSchema: zodToJsonSchema(issues.CreateIssueSchema), },
- src/operations/issues.ts:92-106 (helper)Core implementation of createIssue: makes POST request to GitHub API /issues endpoint using githubRequest utility.export async function createIssue( github_pat: string, owner: string, repo: string, options: z.infer<typeof CreateIssueOptionsSchema> ) { return githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/issues`, { method: "POST", body: options, } ); }