create-issue
Generate and submit new issues in GitHub repositories, specifying owner, repo, title, body, and labels via an MCP server integrated with GitHub API.
Instructions
Create a new issue in a GitHub repository
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Issue body | |
| labels | No | Labels to apply to the issue | |
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| title | Yes | Issue title |
Input Schema (JSON Schema)
{
"properties": {
"body": {
"description": "Issue body",
"type": "string"
},
"labels": {
"description": "Labels to apply to the issue",
"items": {
"type": "string"
},
"type": "array"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"title": {
"description": "Issue title",
"type": "string"
}
},
"required": [
"owner",
"repo",
"title",
"body"
],
"type": "object"
}
Implementation Reference
- src/tools.ts:278-319 (handler)The async createIssue handler function that uses Octokit to create a GitHub issue and returns the result or error.const createIssue = async (args: CreateIssueArgs) => { const { owner, repo, title, body, labels = [] } = args; try { const response = await octokit.rest.issues.create({ owner, repo, title, body, labels, }); return { content: [ { type: "text", text: JSON.stringify( { number: response.data.number, title: response.data.title, url: response.data.html_url, created_at: response.data.created_at, message: "Issue created successfully", }, null, 2 ), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: "text", text: `Error creating issue: ${errorMessage}`, }, ], }; } };
- src/tools.ts:78-110 (schema)The tool object definition for 'create-issue' including name, description, and detailed inputSchema."create-issue": { name: "create-issue", description: "Create a new issue in a GitHub repository", inputSchema: { type: "object", properties: { owner: { type: "string", description: "Repository owner (username or organization)", }, repo: { type: "string", description: "Repository name", }, title: { type: "string", description: "Issue title", }, body: { type: "string", description: "Issue body", }, labels: { type: "array", items: { type: "string" }, description: "Labels to apply to the issue", } }, required: ["owner", "repo", "title", "body"], }, },
- src/tools.ts:322-327 (registration)Export of toolHandlers object that maps tool names to their handler functions, registering 'create-issue' to createIssue.export const toolHandlers = { "search-repos": searchRepos, "get-repo-info": getRepoInfo, "list-issues": listIssues, "create-issue": createIssue, };
- src/tools.ts:132-138 (schema)TypeScript type definition for CreateIssueArgs used in the handler signature.type CreateIssueArgs = { owner: string; repo: string; title: string; body: string; labels?: string[]; };
- src/handlers.ts:22-32 (registration)MCP server request handler for CallToolRequestSchema that dispatches to the specific tool handler based on name, effectively registering all tools including create-issue.server.setRequestHandler(CallToolRequestSchema, async (request) => { type ToolHandlerKey = keyof typeof toolHandlers; const { name, arguments: params } = request.params ?? {}; const handler = toolHandlers[name as ToolHandlerKey]; if (!handler) throw new Error("tool not found"); type HandlerParams = Parameters<typeof handler>; return handler(params as any); }) }