create_ticket
Generate and submit a Jira ticket via API by specifying project key, summary, description, issue type, and optional parent ticket key for organization.
Instructions
Create a ticket on Jira on the api /rest/api/3/issue. Do not use markdown in any field.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | The description of the ticket | |
| issuetype | Yes | ||
| parent | No | The key of the parent ticket (the epic) | |
| project | Yes | ||
| summary | Yes | The summary of the ticket |
Implementation Reference
- src/index.ts:761-801 (handler)MCP server request handler case for 'create_ticket' tool: validates input arguments, calls the createTicket helper function, and returns the JSON response or error.case 'create_ticket': { const project: any = request.params.arguments?.project; const summary: any = request.params.arguments?.summary; const description: any = request.params.arguments?.description; const issuetype: any = request.params.arguments?.issuetype; const parent: any = request.params.arguments?.parent; if (!project || !summary || !description || !issuetype) { throw new Error( 'Project, summary, description and issuetype are required', ); } try { const response = await createTicket( project.key, summary, description, issuetype.name, parent, ); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: JSON.stringify(error.response.data, null, 2), }, ], }; } }
- src/index.ts:462-515 (helper)Helper function implementing the core API call to create a Jira ticket using axios POST to /rest/api/3/issue, formats description as ADF, handles optional parent epic.async function createTicket( project: string, summary: string, description: string, issuetype: string, parentID?: string, ): Promise<any> { try { const jiraDescription = { type: 'doc', version: 1, content: [ { type: 'paragraph', content: [ { type: 'text', text: description, }, ], }, ], }; //parent is somethng like "parent": {"key": "SCRUM-19"} const parent = parentID ? { key: parentID } : undefined; const response = await axios.post( `${JIRA_URL}/rest/api/3/issue`, { fields: { project: { key: project, }, summary, description: description ? jiraDescription : undefined, issuetype: { name: issuetype, }, parent, }, }, { headers: getAuthHeaders().headers, }, ); return response.data; } catch (error: any) { return { error: error.response.data, }; } }
- src/index.ts:81-123 (registration)Tool registration in ListToolsRequestSchema handler: defines name 'create_ticket', description, and detailed inputSchema for MCP tool discovery.{ name: 'create_ticket', description: 'Create a ticket on Jira on the api /rest/api/3/issue. Do not use markdown in any field.', inputSchema: { type: 'object', properties: { project: { type: 'object', properties: { key: { type: 'string', description: 'The project key', }, }, required: ['key'], }, summary: { type: 'string', description: 'The summary of the ticket', }, description: { type: 'string', description: 'The description of the ticket', }, issuetype: { type: 'object', properties: { name: { type: 'string', description: 'The name of the issue type', }, }, required: ['name'], }, parent: { type: 'string', description: 'The key of the parent ticket (the epic)', }, }, required: ['project', 'summary', 'description', 'issuetype'], }, },
- src/index.ts:85-122 (schema)Input schema definition for the create_ticket tool, specifying required fields like project.key, summary, description, issuetype.name, and optional parent.inputSchema: { type: 'object', properties: { project: { type: 'object', properties: { key: { type: 'string', description: 'The project key', }, }, required: ['key'], }, summary: { type: 'string', description: 'The summary of the ticket', }, description: { type: 'string', description: 'The description of the ticket', }, issuetype: { type: 'object', properties: { name: { type: 'string', description: 'The name of the issue type', }, }, required: ['name'], }, parent: { type: 'string', description: 'The key of the parent ticket (the epic)', }, }, required: ['project', 'summary', 'description', 'issuetype'], },