delete_ticket
Remove a specific ticket from Zendesk Support by providing its unique ID, ensuring efficient ticket management and system cleanup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Ticket ID to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "Ticket ID to delete",
"type": "number"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/tickets.js:230-249 (handler)The handler function that executes the 'delete_ticket' tool logic: calls zendeskClient.deleteTicket(id) and returns formatted success or error response.handler: async ({ id }) => { try { await zendeskClient.deleteTicket(id); return { content: [ { type: "text", text: `Ticket ${id} deleted successfully!`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting ticket: ${error.message}` }, ], isError: true, }; } },
- src/tools/tickets.js:227-229 (schema)Input schema using Zod for the 'delete_ticket' tool, defining the required 'id' parameter.schema: { id: z.number().describe("Ticket ID to delete"), },
- src/zendesk-client.js:96-98 (helper)ZendeskClient helper method that sends the DELETE request to the Zendesk API to delete the specified ticket.async deleteTicket(id) { return this.request("DELETE", `/tickets/${id}.json`); }
- src/server.js:48-52 (registration)Tool registration loop in MCP server that registers the 'delete_ticket' tool (included via ticketsTools) using server.tool().allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });