create-issue
Create new issues in GitHub repositories to report bugs, request features, or track tasks directly from MCP-compatible applications.
Instructions
Create a new issue in a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| title | Yes | Issue title | |
| body | Yes | Issue body | |
| labels | No | Labels to apply to the issue |
Implementation Reference
- src/tools.ts:278-319 (handler)The handler function that executes the 'create-issue' tool logic, calling the GitHub API to create an issue and returning the result.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 schema definition for 'create-issue', including input schema for validation."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)Registration of the 'create-issue' handler in the toolHandlers map, used by the MCP server to dispatch tool calls.export const toolHandlers = { "search-repos": searchRepos, "get-repo-info": getRepoInfo, "list-issues": listIssues, "create-issue": createIssue, };
- src/handlers.ts:19-21 (registration)MCP server request handlers for listing tools (using the tools object) and calling tools (using toolHandlers[name]).server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools) }));
- src/tools.ts:132-138 (helper)Type definition for the arguments of the createIssue handler.type CreateIssueArgs = { owner: string; repo: string; title: string; body: string; labels?: string[]; };