Skip to main content
Glama
jakedx6
by jakedx6

create_workflow_rule

Automate project management by creating rules that trigger actions based on specific events like task changes or document updates.

Instructions

Create an automation rule that triggers actions based on events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the automation rule
descriptionNoDescription of what this rule does
triggerYes
actionsYesActions to perform when rule is triggered
project_idNoProject this rule applies to (optional for global rules)
enabledNoWhether this rule is active

Implementation Reference

  • The core handler function for the 'create_workflow_rule' tool. It validates input using Zod schema, logs the action, delegates to supabaseService.createWorkflowRule (a placeholder implementation), and returns the created rule with a success message.
    export const createWorkflowRule = requireAuth(async (args: any) => { const { name, description, trigger, actions, project_id, enabled } = CreateWorkflowRuleSchema.parse(args) logger.info('Creating workflow rule', { name, trigger: trigger.event_type, actions: actions.length }) const rule = await supabaseService.createWorkflowRule({ name, description, trigger, actions, project_id, enabled, created_at: new Date().toISOString() }) return { rule, message: `Workflow rule "${name}" created successfully` } })
  • Zod schema used for input validation in the createWorkflowRule handler, defining structure for name, description, trigger, actions, project_id, and enabled.
    const CreateWorkflowRuleSchema = z.object({ name: z.string().min(1).max(200), description: z.string().optional(), trigger: z.object({ event_type: z.enum(['task_status_changed', 'task_created', 'task_overdue', 'project_status_changed', 'document_created', 'document_updated']), conditions: z.record(z.any()).optional() }), actions: z.array(z.object({ action_type: z.enum(['create_task', 'update_task', 'send_notification', 'assign_task', 'move_task', 'create_document']), parameters: z.record(z.any()) })).min(1), project_id: z.string().optional(), enabled: z.boolean().default(true) })
  • MCPTool registration for 'create_workflow_rule', including the tool name, description, and detailed JSON inputSchema defining expected parameters.
    export const createWorkflowRuleTool: MCPTool = { name: 'create_workflow_rule', description: 'Create an automation rule that triggers actions based on events', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the automation rule' }, description: { type: 'string', description: 'Description of what this rule does' }, trigger: { type: 'object', properties: { event_type: { type: 'string', enum: ['task_status_changed', 'task_created', 'task_overdue', 'project_status_changed', 'document_created', 'document_updated'], description: 'Type of event that triggers this rule' }, conditions: { type: 'object', description: 'Conditions that must be met for trigger to fire' } }, required: ['event_type'] }, actions: { type: 'array', items: { type: 'object', properties: { action_type: { type: 'string', enum: ['create_task', 'update_task', 'send_notification', 'assign_task', 'move_task', 'create_document'], description: 'Type of action to perform' }, parameters: { type: 'object', description: 'Parameters for the action' } }, required: ['action_type', 'parameters'] }, description: 'Actions to perform when rule is triggered' }, project_id: { type: 'string', description: 'Project this rule applies to (optional for global rules)' }, enabled: { type: 'boolean', default: true, description: 'Whether this rule is active' } }, required: ['name', 'trigger', 'actions'] } }
  • Registration of the createWorkflowRule handler in the workflowAutomationHandlers object, mapping tool name to handler function.
    export const workflowAutomationHandlers = { create_workflow_rule: createWorkflowRule, list_workflow_rules: listWorkflowRules, execute_workflow_rule: executeWorkflowRule, create_trigger_automation: createTriggerAutomation, get_automation_analytics: getAutomationAnalytics }
  • Export of workflowAutomationTools object including createWorkflowRuleTool for overall tool registration.
    export const workflowAutomationTools = { createWorkflowRuleTool, listWorkflowRulesTool, executeWorkflowRuleTool, createTriggerAutomationTool, getAutomationAnalyticsTool }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jakedx6/helios9-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server