create_ticket
Create a support ticket by providing title and description. Set priority and select your ITSM system to log the issue.
Instructions
Create a new support ticket in the appropriate ITSM system
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Title of the ticket | |
| description | Yes | Detailed description of the issue | |
| priority | No | Priority level | medium |
| system | No | ITSM system to use | jira |
Implementation Reference
- index.js:92-111 (handler)Business logic function that creates a ticket: generates an ID, builds the ticket object with metadata (status, timestamps, assignee, comments), stores it in an in-memory Map, and returns a success response with ticket details and a URL.
function createTicket({ title, description, priority = 'medium', system = 'jira' }) { const id = generateTicketId(system); const ticket = { id, title, description, priority, status: 'open', system, created_at: new Date().toISOString(), updated_at: new Date().toISOString(), assignee: null, comments: [], }; tickets.set(id, ticket); return { success: true, ticket: { id, title, system, status: 'open', priority, url: `https://example.com/${system}/tickets/${id}` }, }; } - index.js:182-202 (registration)MCP server.tool() registration for 'create_ticket'. Registers the tool with description, Zod schema inputs (title, description, priority, system), annotation metadata, and a callback that delegates to the createTicket handler and returns the JSON result.
server.tool( 'create_ticket', 'Create a new support ticket in the appropriate ITSM system', { title: z.string().describe('Title of the ticket'), description: z.string().describe('Detailed description of the issue'), priority: prioritySchema, system: systemSchema, }, { title: 'Create Ticket', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false, }, async ({ title, description, priority, system }) => { const result = createTicket({ title, description, priority, system }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }, ); - index.js:67-75 (schema)Reusable Zod schema definitions used by create_ticket: systemSchema (enum of ITSM systems, default jira) and prioritySchema (enum of priority levels, default medium).
const systemSchema = z .enum(['servicenow', 'jira', 'zendesk', 'ivanti_neurons', 'cherwell']) .default('jira') .describe('ITSM system to use'); const prioritySchema = z .enum(['low', 'medium', 'high', 'critical']) .default('medium') .describe('Priority level'); - index.js:81-90 (helper)Helper function that generates a ticket ID with a system-specific prefix (e.g., JIRA-, SN-, ZD-) and an auto-incrementing numeric ID.
function generateTicketId(system = 'jira') { const prefixes = { jira: 'JIRA', servicenow: 'SN', zendesk: 'ZD', ivanti_neurons: 'IV', cherwell: 'CH', }; return `${prefixes[system] ?? 'TKT'}-${nextTicketId++}`; } - Frontend MCP service method that wraps callTool('create_ticket', ...) with typed parameters for use by React components.
/** * Create a ticket using MCP */ async createTicket(title, description, priority = 'medium', system = 'jira') { return this.callTool('create_ticket', { title, description, priority, system, }); }