create_issue
Create Jira issues by specifying project, summary, and description to track tasks, bugs, or features in your workflow.
Instructions
Create an issue in Jira
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectKeyOrId | Yes | The key or ID of the project | |
| summary | Yes | The summary of the issue | |
| description | Yes | The description of the issue |
Implementation Reference
- src/tools/create-issue.ts:33-53 (handler)Core handler function for the 'create_issue' tool. Constructs a Jira issue payload with project, task type, summary, and description, then POSTs it to the Jira REST API endpoint `/rest/api/2/issue` using the `$jiraJson` utility.export async function createIssue(input: CreateIssueInput) { const url = new URL(`/rest/api/2/issue`, env.JIRA_BASE_URL); const payload = { fields: { project: { key: input.projectKeyOrId }, issuetype: { name: ISSUE_TYPES.TASK }, summary: input.summary, description: input.description, }, }; const json = await $jiraJson(url.toString(), { method: "POST", body: JSON.stringify(payload), }); if (json.isErr()) return err(json.error); return ok(json.value); }
- src/tools/create-issue.ts:19-23 (schema)Zod input schema for validating the parameters of the 'create_issue' tool: projectKeyOrId, summary, and description.export const createIssueInputSchema = z.object({ projectKeyOrId: z.string().describe("The key or ID of the project"), summary: z.string().describe("The summary of the issue"), description: z.string().describe("The description of the issue"), });
- src/tools/create-issue.ts:25-29 (registration)Tool registration object defining the name, description, and input schema for 'create_issue', exported for use in the main app.export const CREATE_ISSUE_TOOL: Tool = { name: "create_issue", description: "Create an issue in Jira", inputSchema: zodToJsonSchema(createIssueInputSchema) as Tool["inputSchema"], };
- src/app.ts:39-48 (registration)Central tools array registration that includes CREATE_ISSUE_TOOL among other tools, used by the MCP server's ListToolsRequestHandler.export const tools = [ // list LIST_PROJECTS_TOOL, LIST_BOARDS_TOOL, LIST_SPRINTS_FROM_BOARD_TOOL, LIST_ISSUES_FROM_SPRINT_TOOL, // create CREATE_ISSUE_TOOL, ] satisfies Tool[];
- src/app.ts:169-194 (handler)Dispatch logic in the main CallToolRequestHandler that validates input using the schema and invokes the createIssue handler for the 'create_issue' tool.if (name === CREATE_ISSUE_TOOL.name) { const input = createIssueInputSchema.safeParse(args); if (!input.success) { return { isError: true, content: [{ type: "text", text: "Invalid input" }], }; } const result = await createIssue(input.data); if (result.isErr()) { console.error(result.error.message); return { isError: true, content: [{ type: "text", text: "An error occurred" }], }; } return { content: [ { type: "text", text: JSON.stringify(result.value, null, 2) }, ], }; }