create_ticket
Submit support tickets via the Zendesk API, specifying subject, comment, priority, status, requester, assignee, group, type, or tags for efficient issue tracking and resolution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee_id | No | User ID of the assignee | |
| comment | Yes | Ticket comment/description | |
| group_id | No | Group ID for the ticket | |
| priority | No | Ticket priority | |
| requester_id | No | User ID of the requester | |
| status | No | Ticket status | |
| subject | Yes | Ticket subject | |
| tags | No | Tags for the ticket | |
| type | No | Ticket type |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"assignee_id": {
"description": "User ID of the assignee",
"type": "number"
},
"comment": {
"description": "Ticket comment/description",
"type": "string"
},
"group_id": {
"description": "Group ID for the ticket",
"type": "number"
},
"priority": {
"description": "Ticket priority",
"enum": [
"urgent",
"high",
"normal",
"low"
],
"type": "string"
},
"requester_id": {
"description": "User ID of the requester",
"type": "number"
},
"status": {
"description": "Ticket status",
"enum": [
"new",
"open",
"pending",
"hold",
"solved",
"closed"
],
"type": "string"
},
"subject": {
"description": "Ticket subject",
"type": "string"
},
"tags": {
"description": "Tags for the ticket",
"items": {
"type": "string"
},
"type": "array"
},
"type": {
"description": "Ticket type",
"enum": [
"problem",
"incident",
"question",
"task"
],
"type": "string"
}
},
"required": [
"subject",
"comment"
],
"type": "object"
}
Implementation Reference
- src/tools/tickets.js:92-137 (handler)The main handler function for the 'create_ticket' tool. It takes input parameters, constructs the ticket data object, calls zendeskClient.createTicket, and returns a formatted success or error response.handler: async ({ subject, comment, priority, status, requester_id, assignee_id, group_id, type, tags, }) => { try { const ticketData = { subject, comment: { body: comment }, priority, status, requester_id, assignee_id, group_id, type, tags, }; const result = await zendeskClient.createTicket(ticketData); return { content: [ { type: "text", text: `Ticket created successfully!\n\n${JSON.stringify( result, null, 2 )}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating ticket: ${error.message}` }, ], isError: true, }; } },
- src/tools/tickets.js:72-91 (schema)Zod schema defining the input parameters for the 'create_ticket' tool, including required subject and comment, and optional fields like priority, status, requester_id, etc.schema: { subject: z.string().describe("Ticket subject"), comment: z.string().describe("Ticket comment/description"), priority: z .enum(["urgent", "high", "normal", "low"]) .optional() .describe("Ticket priority"), status: z .enum(["new", "open", "pending", "hold", "solved", "closed"]) .optional() .describe("Ticket status"), requester_id: z.number().optional().describe("User ID of the requester"), assignee_id: z.number().optional().describe("User ID of the assignee"), group_id: z.number().optional().describe("Group ID for the ticket"), type: z .enum(["problem", "incident", "question", "task"]) .optional() .describe("Ticket type"), tags: z.array(z.string()).optional().describe("Tags for the ticket"), },
- src/server.js:47-52 (registration)Registers all tools, including 'create_ticket' (via ticketsTools), with the MCP server using server.tool() for each tool's name, schema, handler, and description.// Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:85-87 (helper)Helper method in ZendeskClient that performs the actual API POST request to create a ticket by wrapping the generic request method.async createTicket(data) { return this.request("POST", "/tickets.json", { ticket: data }); }