zendesk_create_ticket
Create a Zendesk ticket with defined subject, description, priority, status, type, and tags to manage support requests effectively.
Instructions
Create a new Zendesk ticket
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | The initial description or comment for the ticket | |
| priority | No | The priority of the ticket | |
| status | No | The status of the ticket | |
| subject | Yes | The subject of the ticket | |
| tags | No | Tags to add to the ticket | |
| type | No | The type of the ticket |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"description": {
"description": "The initial description or comment for the ticket",
"type": "string"
},
"priority": {
"description": "The priority of the ticket",
"enum": [
"low",
"normal",
"high",
"urgent"
],
"type": "string"
},
"status": {
"description": "The status of the ticket",
"enum": [
"new",
"open",
"pending",
"hold",
"solved",
"closed"
],
"type": "string"
},
"subject": {
"description": "The subject of the ticket",
"type": "string"
},
"tags": {
"description": "Tags to add to the ticket",
"items": {
"type": "string"
},
"type": "array"
},
"type": {
"description": "The type of the ticket",
"enum": [
"problem",
"incident",
"question",
"task"
],
"type": "string"
}
},
"required": [
"subject",
"description"
],
"type": "object"
}
Implementation Reference
- src/tools/index.ts:185-225 (handler)The handler function that executes the zendesk_create_ticket tool: constructs ticket data from inputs and calls the Zendesk API to create the ticket.async ({ subject, description, priority, status, type, tags }) => { try { const ticketData: any = { ticket: { subject, comment: { body: description }, } }; if (priority) ticketData.ticket.priority = priority; if (status) ticketData.ticket.status = status; if (type) ticketData.ticket.type = type; if (tags) ticketData.ticket.tags = tags; const result = await new Promise((resolve, reject) => { (client as any).tickets.create(ticketData, (error: Error | undefined, req: any, result: any) => { if (error) { console.log(error); reject(error); } else { resolve(result); } }); }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message || 'Unknown error occurred'}` }], isError: true }; } }
- src/tools/index.ts:177-184 (schema)Input schema (using Zod) defining parameters for the zendesk_create_ticket tool.{ subject: z.string().describe("The subject of the ticket"), description: z.string().describe("The initial description or comment for the ticket"), priority: z.enum(['low', 'normal', 'high', 'urgent']).optional().describe("The priority of the ticket"), status: z.enum(['new', 'open', 'pending', 'hold', 'solved', 'closed']).optional().describe("The status of the ticket"), type: z.enum(['problem', 'incident', 'question', 'task']).optional().describe("The type of the ticket"), tags: z.array(z.string()).optional().describe("Tags to add to the ticket") },
- src/tools/index.ts:174-226 (registration)Registration of the zendesk_create_ticket tool on the MCP server, including name, description, input schema, and handler.server.tool( "zendesk_create_ticket", "Create a new Zendesk ticket", { subject: z.string().describe("The subject of the ticket"), description: z.string().describe("The initial description or comment for the ticket"), priority: z.enum(['low', 'normal', 'high', 'urgent']).optional().describe("The priority of the ticket"), status: z.enum(['new', 'open', 'pending', 'hold', 'solved', 'closed']).optional().describe("The status of the ticket"), type: z.enum(['problem', 'incident', 'question', 'task']).optional().describe("The type of the ticket"), tags: z.array(z.string()).optional().describe("Tags to add to the ticket") }, async ({ subject, description, priority, status, type, tags }) => { try { const ticketData: any = { ticket: { subject, comment: { body: description }, } }; if (priority) ticketData.ticket.priority = priority; if (status) ticketData.ticket.status = status; if (type) ticketData.ticket.type = type; if (tags) ticketData.ticket.tags = tags; const result = await new Promise((resolve, reject) => { (client as any).tickets.create(ticketData, (error: Error | undefined, req: any, result: any) => { if (error) { console.log(error); reject(error); } else { resolve(result); } }); }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message || 'Unknown error occurred'}` }], isError: true }; } } );
- src/tools/index.ts:84-88 (helper)Zendesk client instance created from environment variables, used by the zendesk_create_ticket handler.const client = zendesk.createClient({ username: process.env.ZENDESK_EMAIL as string, token: process.env.ZENDESK_TOKEN as string, remoteUri: `https://${process.env.ZENDESK_SUBDOMAIN}.zendesk.com/api/v2`, });
- src/index.ts:34-34 (registration)Top-level call to register all Zendesk tools, including zendesk_create_ticket, on the MCP server.zenDeskTools(server);