Skip to main content
Glama

create-issue

Generate a new issue in a GitHub repository by specifying the owner, repo, title, body, and optional labels. Simplify issue creation within the GitHub MCP Server's workflow.

Instructions

Create a new issue in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesIssue body
labelsNoLabels to apply to the issue
ownerYesRepository owner (username or organization)
repoYesRepository name
titleYesIssue title

Implementation Reference

  • The main handler function for the 'create-issue' tool. It destructures the arguments, calls the GitHub API via Octokit to create an 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}`, }, ], }; } };
  • The input schema definition for the 'create-issue' tool, including properties, types, descriptions, and required fields.
    "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)
    Registers the 'create-issue' handler function (createIssue) in the toolHandlers object, which is 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)
    Registers the handler for listing tools, which exposes the 'create-issue' schema via the imported tools object.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools) }));
  • src/handlers.ts:22-32 (registration)
    Registers the generic tool call handler that dispatches to the specific handler (createIssue) based on the tool name 'create-issue' from toolHandlers.
    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); }) }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alsonwangkhem/github-mcp-2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server