create_issue
Create a new issue in a GitHub repository to report bugs, request features, or track tasks. Specify repository, title, and optional details like labels or assignees.
Instructions
Create a new issue in a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | ||
| repo | Yes | ||
| title | Yes | ||
| body | No | ||
| assignees | No | ||
| milestone | No | ||
| labels | No |
Implementation Reference
- src/operations/issues.ts:92-106 (handler)Core handler function that performs the HTTP POST request to the GitHub API to create an issue.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, } ); }
- src/operations/issues.ts:25-41 (schema)Zod schemas defining the input structure for creating an issue, including options, base schema, and extended schema with GitHub PAT.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:104-107 (registration)Tool registration in the ListTools response, specifying name, description, and input schema.name: "create_issue", description: "Create a new issue in a GitHub repository", inputSchema: zodToJsonSchema(issues.CreateIssueSchema), },
- src/index.ts:437-444 (handler)MCP server dispatch handler case for 'create_issue', parsing args and calling the core createIssue function.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) }], }; }