n8n_update_workflow
Modify existing n8n workflows by updating nodes, connections, settings, or renaming them through the Cursor IDE integration.
Instructions
Update an existing workflow. You can update name, nodes, connections, or settings.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The workflow ID to update | |
| name | No | New name for the workflow | |
| nodes | No | Updated array of nodes (replaces all existing nodes) | |
| connections | No | Updated connections object (replaces all existing connections) | |
| settings | No | Updated workflow settings |
Implementation Reference
- src/tools/workflow-tools.ts:274-310 (handler)The main handler function that executes the n8n_update_workflow tool logic. It validates the workflow ID, constructs updateData from input arguments, calls the N8nApiClient.updateWorkflow method, and returns a formatted success response.n8n_update_workflow: async ( client: N8nApiClient, args: Record<string, unknown> ): Promise<ToolResult> => { const id = args.id as string; if (!id) { throw new Error('Workflow ID is required'); } const updateData: Parameters<typeof client.updateWorkflow>[1] = {}; if (args.name !== undefined) updateData.name = args.name as string; if (args.nodes !== undefined) updateData.nodes = args.nodes as N8nNode[]; if (args.connections !== undefined) updateData.connections = args.connections as N8nConnections; if (args.settings !== undefined) updateData.settings = args.settings as N8nWorkflowSettings; const workflow = await client.updateWorkflow(id, updateData); return { content: [ { type: 'text' as const, text: JSON.stringify({ success: true, message: `Workflow "${workflow.name}" updated successfully`, workflow: { id: workflow.id, name: workflow.name, active: workflow.active, nodeCount: workflow.nodes.length, updatedAt: workflow.updatedAt, }, }, null, 2), }, ], }; },
- src/tools/workflow-tools.ts:87-116 (schema)The ToolDefinition object defining the input schema, description, and parameters validation for the n8n_update_workflow tool.{ name: 'n8n_update_workflow', description: 'Update an existing workflow. You can update name, nodes, connections, or settings.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The workflow ID to update', }, name: { type: 'string', description: 'New name for the workflow', }, nodes: { type: 'array', description: 'Updated array of nodes (replaces all existing nodes)', }, connections: { type: 'object', description: 'Updated connections object (replaces all existing connections)', }, settings: { type: 'object', description: 'Updated workflow settings', }, }, required: ['id'], }, },
- src/server.ts:60-64 (registration)MCP server registration for listing tools, returning allTools which includes the n8n_update_workflow schema definition.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });
- src/server.ts:122-125 (registration)Handler dispatch registration in MCP callTool request handler. Routes calls to n8n_update_workflow (and other workflow tools) by looking up in workflowToolHandlers object.if (name in workflowToolHandlers) { const handler = workflowToolHandlers[name as keyof typeof workflowToolHandlers]; return handler(client, args); }
- src/tools/index.ts:12-16 (registration)Central aggregation of all tool schemas into allTools by spreading workflowTools (containing n8n_update_workflow definition).export const allTools: ToolDefinition[] = [ ...documentationTools, // Documentation first for discoverability ...workflowTools, ...executionTools, ];