create_trigger_automation
Set up automated workflows that respond to project events like task completion or deadlines, performing actions such as creating follow-up tasks or notifying teams.
Instructions
Create automated workflows triggered by specific events
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| automation_name | Yes | Name of the automation | |
| trigger_events | Yes | Events that trigger this automation | |
| conditions | No | Conditions that must be met | |
| automated_actions | Yes | Actions to perform automatically | |
| project_scope | No | Scope of automation | single_project |
Implementation Reference
- src/tools/workflow-automation.ts:319-341 (handler)The main handler function that executes the create_trigger_automation tool logic. It validates input using Zod schema, logs the action, calls the supabaseService to create the automation, and returns a success response with details.export const createTriggerAutomation = requireAuth(async (args: any) => { const { automation_name, trigger_events, conditions, automated_actions, project_scope } = CreateTriggerAutomationSchema.parse(args) logger.info('Creating trigger automation', { automation_name, trigger_events, actions_count: automated_actions.length }) const automation = await supabaseService.createTriggerAutomation({ name: automation_name, trigger_events, conditions: conditions || {}, actions: automated_actions, scope: project_scope, enabled: true, created_at: new Date().toISOString() }) return { automation, trigger_count: trigger_events.length, action_count: automated_actions.length, scope: project_scope, message: `Automation "${automation_name}" created and enabled` } })
- Zod schema used for input validation in the createTriggerAutomation handler.const CreateTriggerAutomationSchema = z.object({ automation_name: z.string().min(1).max(200), trigger_events: z.array(z.enum(['task_completed', 'task_blocked', 'deadline_approaching', 'project_milestone', 'team_member_assigned'])).min(1), conditions: z.object({ priority: z.enum(['low', 'medium', 'high', 'urgent']).optional(), project_id: z.string().optional(), assignee_id: z.string().optional(), tags: z.array(z.string()).optional() }).optional(), automated_actions: z.array(z.object({ type: z.enum(['create_follow_up_task', 'notify_team', 'update_project_status', 'assign_reviewer', 'schedule_meeting']), config: z.record(z.any()) })).min(1), project_scope: z.enum(['single_project', 'all_projects', 'specific_projects']).default('single_project') })
- src/tools/workflow-automation.ts:249-301 (registration)MCPTool object that registers the create_trigger_automation tool, including its name, description, and JSON input schema for MCP protocol.export const createTriggerAutomationTool: MCPTool = { name: 'create_trigger_automation', description: 'Create automated workflows triggered by specific events', inputSchema: { type: 'object', properties: { automation_name: { type: 'string', description: 'Name of the automation' }, trigger_events: { type: 'array', items: { type: 'string', enum: ['task_completed', 'task_blocked', 'deadline_approaching', 'project_milestone', 'team_member_assigned'] }, description: 'Events that trigger this automation' }, conditions: { type: 'object', properties: { priority: { type: 'string', enum: ['low', 'medium', 'high', 'urgent'] }, project_id: { type: 'string' }, assignee_id: { type: 'string' }, tags: { type: 'array', items: { type: 'string' } } }, description: 'Conditions that must be met' }, automated_actions: { type: 'array', items: { type: 'object', properties: { type: { type: 'string', enum: ['create_follow_up_task', 'notify_team', 'update_project_status', 'assign_reviewer', 'schedule_meeting'] }, config: { type: 'object' } }, required: ['type', 'config'] }, description: 'Actions to perform automatically' }, project_scope: { type: 'string', enum: ['single_project', 'all_projects', 'specific_projects'], default: 'single_project', description: 'Scope of automation' } }, required: ['automation_name', 'trigger_events', 'automated_actions'] } }
- src/tools/workflow-automation.ts:602-608 (registration)Object exporting the handler mappings by tool name, used for registration in the MCP server.export const workflowAutomationHandlers = { create_workflow_rule: createWorkflowRule, list_workflow_rules: listWorkflowRules, execute_workflow_rule: executeWorkflowRule, create_trigger_automation: createTriggerAutomation, get_automation_analytics: getAutomationAnalytics }