update_macro
Modify Zendesk macros by updating title, description, and actions to streamline customer support workflows and maintain consistent ticket resolutions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | No | Updated actions | |
| description | No | Updated macro description | |
| id | Yes | Macro ID to update | |
| title | No | Updated macro title |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"actions": {
"description": "Updated actions",
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to modify",
"type": "string"
},
"value": {
"description": "Value to set"
}
},
"required": [
"field"
],
"type": "object"
},
"type": "array"
},
"description": {
"description": "Updated macro description",
"type": "string"
},
"id": {
"description": "Macro ID to update",
"type": "number"
},
"title": {
"description": "Updated macro title",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/macros.js:99-120 (handler)The asynchronous handler function that implements the core logic of the 'update_macro' tool. It constructs the update data from optional parameters and delegates to zendeskClient.updateMacro, returning formatted success or error responses.handler: async ({ id, title, description, actions }) => { try { const macroData = {}; if (title !== undefined) macroData.title = title; if (description !== undefined) macroData.description = description; if (actions !== undefined) macroData.actions = actions; const result = await zendeskClient.updateMacro(id, macroData); return { content: [{ type: "text", text: `Macro updated successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating macro: ${error.message}` }], isError: true }; } }
- src/tools/macros.js:90-98 (schema)Zod schema for input validation of the 'update_macro' tool, requiring 'id' and allowing optional 'title', 'description', and 'actions'.schema: { id: z.number().describe("Macro ID to update"), title: z.string().optional().describe("Updated macro title"), description: z.string().optional().describe("Updated macro description"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).optional().describe("Updated actions") },
- src/tools/macros.js:87-121 (registration)The complete tool definition object for 'update_macro', including name, description, schema, and handler, which is part of the exported macrosTools array registered to the MCP server.{ name: "update_macro", description: "Update an existing macro", schema: { id: z.number().describe("Macro ID to update"), title: z.string().optional().describe("Updated macro title"), description: z.string().optional().describe("Updated macro description"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).optional().describe("Updated actions") }, handler: async ({ id, title, description, actions }) => { try { const macroData = {}; if (title !== undefined) macroData.title = title; if (description !== undefined) macroData.description = description; if (actions !== undefined) macroData.actions = actions; const result = await zendeskClient.updateMacro(id, macroData); return { content: [{ type: "text", text: `Macro updated successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating macro: ${error.message}` }], isError: true }; } } },
- src/zendesk-client.js:178-180 (helper)ZendeskClient helper method that sends a PUT request to the Zendesk API to update the specified macro.async updateMacro(id, data) { return this.request("PUT", `/macros/${id}.json`, { macro: data }); }