update_trigger
Modify Zendesk triggers by updating their title, description, conditions, or actions using the associated trigger ID for precise automation adjustments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | No | Updated actions | |
| conditions | No | Updated conditions | |
| description | No | Updated trigger description | |
| id | Yes | Trigger ID to update | |
| title | No | Updated trigger title |
Implementation Reference
- src/tools/triggers.js:124-146 (handler)The handler function for the 'update_trigger' tool. It constructs the trigger data from optional parameters and calls zendeskClient.updateTrigger(id, triggerData), then returns success or error response.handler: async ({ id, title, description, conditions, actions }) => { try { const triggerData = {}; if (title !== undefined) triggerData.title = title; if (description !== undefined) triggerData.description = description; if (conditions !== undefined) triggerData.conditions = conditions; if (actions !== undefined) triggerData.actions = actions; const result = await zendeskClient.updateTrigger(id, triggerData); return { content: [{ type: "text", text: `Trigger updated successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating trigger: ${error.message}` }], isError: true }; } }
- src/tools/triggers.js:103-123 (schema)Zod schema defining the input parameters for the 'update_trigger' tool: id (required), and optional title, description, conditions, actions.schema: { id: z.number().describe("Trigger ID to update"), title: z.string().optional().describe("Updated trigger title"), description: z.string().optional().describe("Updated trigger description"), conditions: z.object({ all: z.array(z.object({ field: z.string().describe("Field to check"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional(), any: z.array(z.object({ field: z.string().describe("Field to check"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional() }).optional().describe("Updated conditions"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).optional().describe("Updated actions") },
- src/server.js:48-52 (registration)Registration of the 'update_trigger' tool (included in triggersTools) via server.tool() in the loop over allTools.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:220-222 (helper)ZendeskClient helper method that makes the PUT request to /triggers/{id}.json API endpoint to update the trigger.async updateTrigger(id, data) { return this.request("PUT", `/triggers/${id}.json`, { trigger: data }); }