maasy_trigger_workflow
Trigger a Maasy workflow manually to run automations, sequences, or CRM flows for a specific contact with custom variables.
Instructions
Trigger a maasy workflow manually — automations, sequences, CRM flows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Brand UUID | |
| workflow_id | Yes | Workflow UUID (get from maasy → Workflows) | |
| contact_id | No | Contact UUID to run the workflow for | |
| variables | No | Custom variables passed to the workflow |
Implementation Reference
- src/index.ts:341-351 (registration)Registration of the 'maasy_trigger_workflow' tool on the MCP server. It defines the schema (workflow_id, contact_id, variables) and delegates to toolHandler('trigger_workflow').
server.tool( "maasy_trigger_workflow", "Trigger a maasy workflow manually — automations, sequences, CRM flows.", { project_id: z.string().optional().describe("Brand UUID"), workflow_id: z.string().describe("Workflow UUID (get from maasy → Workflows)"), contact_id: z.string().optional().describe("Contact UUID to run the workflow for"), variables: z.record(z.unknown()).optional().describe("Custom variables passed to the workflow"), }, toolHandler("trigger_workflow") ); - src/index.ts:26-43 (handler)Generic toolHandler factory that wraps tool execution. For 'maasy_trigger_workflow', it calls callGateway('trigger_workflow', args) which sends the request to the Supabase mcp-gateway edge function.
function toolHandler(toolName: string, argsFn?: (args: Record<string, unknown>) => Record<string, unknown>) { return async (args: Record<string, unknown>) => { try { const gatewayArgs = argsFn ? argsFn(args) : args; // Auto-inject default project_id if not provided if (DEFAULT_PROJECT_ID && !gatewayArgs.project_id) { gatewayArgs.project_id = DEFAULT_PROJECT_ID; } const result = await callGateway(toolName, gatewayArgs); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `Error: ${e instanceof Error ? e.message : String(e)}` }], isError: true, }; } }; } - src/index.ts:344-349 (schema)Zod schema for the 'maasy_trigger_workflow' tool inputs: optional project_id, required workflow_id string, optional contact_id string, optional variables record.
{ project_id: z.string().optional().describe("Brand UUID"), workflow_id: z.string().describe("Workflow UUID (get from maasy → Workflows)"), contact_id: z.string().optional().describe("Contact UUID to run the workflow for"), variables: z.record(z.unknown()).optional().describe("Custom variables passed to the workflow"), }, - src/supabase.ts:42-59 (helper)The callGateway function that sends the tool name ('trigger_workflow') and arguments to the Supabase edge function (mcp-gateway) via HTTP POST.
export async function callGateway(tool: string, args: Record<string, unknown> = {}): Promise<unknown> { const res = await fetch(gatewayUrl, { method: "POST", headers: { "Content-Type": "application/json", [authHeader.name]: authHeader.value, }, body: JSON.stringify({ tool, args }), }); const data = await res.json(); if (!res.ok) { throw new Error(data.error || `Gateway error (${res.status})`); } return data.result; }