delete_macro
Remove unwanted macros by specifying the ID using the tool on the Zendesk API MCP Server, streamlining macro management and ensuring clean workflows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Macro ID to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "Macro ID to delete",
"type": "number"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/macros.js:128-143 (handler)The handler function that implements the core logic of the delete_macro tool by invoking the Zendesk client's deleteMacro method and handling the response.handler: async ({ id }) => { try { await zendeskClient.deleteMacro(id); return { content: [{ type: "text", text: `Macro ${id} deleted successfully!` }] }; } catch (error) { return { content: [{ type: "text", text: `Error deleting macro: ${error.message}` }], isError: true }; } }
- src/tools/macros.js:125-127 (schema)Zod schema defining the input parameter 'id' as a number for the delete_macro tool.schema: { id: z.number().describe("Macro ID to delete") },
- src/tools/macros.js:122-144 (registration)The tool definition object for 'delete_macro' which is exported as part of macrosTools and later registered with the MCP server.{ name: "delete_macro", description: "Delete a macro", schema: { id: z.number().describe("Macro ID to delete") }, handler: async ({ id }) => { try { await zendeskClient.deleteMacro(id); return { content: [{ type: "text", text: `Macro ${id} deleted successfully!` }] }; } catch (error) { return { content: [{ type: "text", text: `Error deleting macro: ${error.message}` }], isError: true }; } } }
- src/zendesk-client.js:182-184 (helper)Helper method in ZendeskClient that performs the actual API DELETE request to remove the macro.async deleteMacro(id) { return this.request("DELETE", `/macros/${id}.json`); }
- src/server.js:48-52 (registration)Generic registration of all tools, including delete_macro from macrosTools, with the MCP server.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });