create_trigger
Automates ticket management by creating Zendesk triggers that execute specific actions based on defined conditions, streamlining support workflows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | Yes | Actions to perform when trigger conditions are met | |
| conditions | Yes | Conditions for the trigger | |
| description | No | Trigger description | |
| title | Yes | Trigger title |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"actions": {
"description": "Actions to perform when trigger conditions are met",
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to modify",
"type": "string"
},
"value": {
"description": "Value to set"
}
},
"required": [
"field"
],
"type": "object"
},
"type": "array"
},
"conditions": {
"additionalProperties": false,
"description": "Conditions for the trigger",
"properties": {
"all": {
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to check",
"type": "string"
},
"operator": {
"description": "Operator for comparison",
"type": "string"
},
"value": {
"description": "Value to compare against"
}
},
"required": [
"field",
"operator"
],
"type": "object"
},
"type": "array"
},
"any": {
"items": {
"additionalProperties": false,
"properties": {
"field": {
"description": "Field to check",
"type": "string"
},
"operator": {
"description": "Operator for comparison",
"type": "string"
},
"value": {
"description": "Value to compare against"
}
},
"required": [
"field",
"operator"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
},
"description": {
"description": "Trigger description",
"type": "string"
},
"title": {
"description": "Trigger title",
"type": "string"
}
},
"required": [
"title",
"conditions",
"actions"
],
"type": "object"
}
Implementation Reference
- src/tools/triggers.js:76-98 (handler)MCP tool handler for 'create_trigger': validates inputs implicitly via schema, builds triggerData object, calls zendeskClient.createTrigger, formats success/error response.handler: async ({ title, description, conditions, actions }) => { try { const triggerData = { title, description, conditions, actions }; const result = await zendeskClient.createTrigger(triggerData); return { content: [{ type: "text", text: `Trigger created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating trigger: ${error.message}` }], isError: true }; } }
- src/tools/triggers.js:56-75 (schema)Input schema for create_trigger tool using Zod: defines title (required), description (opt), conditions (all/any arrays of field/operator/value), actions (array of field/value).schema: { title: z.string().describe("Trigger title"), description: z.string().optional().describe("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() }).describe("Conditions for the trigger"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).describe("Actions to perform when trigger conditions are met") },
- src/server.js:48-52 (registration)Registration of all tools (including create_trigger from triggersTools) to the MCP server via server.tool() call in loop.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:216-217 (helper)ZendeskClient helper method invoked by the tool handler: sends POST request to Zendesk Triggers API endpoint /triggers.json with trigger data.async createTrigger(data) { return this.request("POST", "/triggers.json", { trigger: data });
- src/server.js:38-38 (registration)Inclusion of triggersTools (containing create_trigger) into the allTools array for registration....triggersTools,