execute_workflow
Runs an n8n workflow by its ID with optional input data to trigger automation processes.
Instructions
Execute a workflow with optional input data
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | The ID of the workflow to execute | |
| data | No | Input data for the workflow execution |
Implementation Reference
- src/handlers.ts:111-114 (handler)Handler case for execute_workflow tool: parses input using ExecuteWorkflowSchema then delegates to client.executeWorkflow()
case "execute_workflow": { const { workflowId, data } = ExecuteWorkflowSchema.parse(args); return await client.executeWorkflow(workflowId, data); } - src/handlers.ts:35-38 (schema)Zod schema definition for execute_workflow input validation: requires workflowId (string), optional data (record of any)
const ExecuteWorkflowSchema = z.object({ workflowId: z.string(), data: z.record(z.any()).optional(), }); - src/tools.ts:163-180 (registration)Tool registration definition: declares execute_workflow with description and inputSchema for MCP protocol
{ name: "execute_workflow", description: "Execute a workflow with optional input data", inputSchema: { type: "object", properties: { workflowId: { type: "string", description: "The ID of the workflow to execute", }, data: { type: "object", description: "Input data for the workflow execution", }, }, required: ["workflowId"], }, }, - src/n8n-client.ts:106-111 (helper)N8nClient.executeWorkflow method: makes POST request to /api/v1/workflows/{id}/execute with optional data payload
async executeWorkflow(id: string, data?: any) { const response = await this.client.post(`/api/v1/workflows/${id}/execute`, { data, }); return response.data; }