update_workflow
Update an existing workflow by modifying its name, nodes, connections, settings, tags, or activation status. Provide the workflow ID to apply changes.
Instructions
Update an existing workflow
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | The ID of the workflow to update | |
| name | No | New name for the workflow | |
| nodes | No | Updated nodes array | |
| connections | No | Updated connections object | |
| active | No | Activation status | |
| settings | No | Updated workflow settings | |
| tags | No | Updated tags |
Implementation Reference
- src/tools.ts:80-118 (registration)Registration/definition of the 'update_workflow' tool in the tools array, including its name, description, and input schema (workflowId required, with optional name, nodes, connections, active, settings, tags).
{ name: "update_workflow", description: "Update an existing workflow", inputSchema: { type: "object", properties: { workflowId: { type: "string", description: "The ID of the workflow to update", }, name: { type: "string", description: "New name for the workflow", }, nodes: { type: "array", description: "Updated nodes array", }, connections: { type: "object", description: "Updated connections object", }, active: { type: "boolean", description: "Activation status", }, settings: { type: "object", description: "Updated workflow settings", }, tags: { type: "array", items: { type: "string" }, description: "Updated tags", }, }, required: ["workflowId"], }, }, - src/handlers.ts:25-33 (schema)Zod validation schema 'UpdateWorkflowSchema' for update_workflow: validates workflowId (string), name, nodes, connections, active, settings, and tags.
const UpdateWorkflowSchema = z.object({ workflowId: z.string(), name: z.string().optional(), nodes: z.array(z.any()).optional(), connections: z.record(z.any()).optional(), active: z.boolean().optional(), settings: z.record(z.any()).optional(), tags: z.array(z.string()).optional(), }); - src/handlers.ts:90-93 (handler)Handler case for 'update_workflow' in handleToolCall: parses args with UpdateWorkflowSchema, destructures workflowId from updateData, then calls client.updateWorkflow(workflowId, updateData).
case "update_workflow": { const { workflowId, ...updateData } = UpdateWorkflowSchema.parse(args); return await client.updateWorkflow(workflowId, updateData); } - src/n8n-client.ts:81-84 (helper)N8nClient.updateWorkflow method: sends a PATCH request to /api/v1/workflows/{id} with the workflow data, and validates the response with WorkflowSchema.
async updateWorkflow(id: string, workflow: any) { const response = await this.client.patch(`/api/v1/workflows/${id}`, workflow); return WorkflowSchema.parse(response.data); }