delete_node
Remove a node from an n8n workflow by specifying the workflow ID and node ID to modify automation processes.
Instructions
Delete a node from an n8n workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | ||
| nodeId | Yes |
Implementation Reference
- src/n8n-client.ts:461-480 (handler)Core handler function that performs the node deletion logic: removes the node from workflow.nodes, cleans up all incoming/outgoing connections, and persists via optimistic update with ETag.async deleteNode(request: DeleteNodeRequest): Promise<DeleteNodeResponse> { await this.performWorkflowUpdate(request.workflowId, (workflow) => { const nodeIndex = workflow.nodes.findIndex((node) => node.id === request.nodeId); if (nodeIndex === -1) { throw new Error(`Node with id ${request.nodeId} not found in workflow ${request.workflowId}`); } const nodeName = workflow.nodes[nodeIndex].name; workflow.nodes.splice(nodeIndex, 1); const connections: any = workflow.connections as any; delete connections[nodeName]; Object.keys(connections).forEach((sourceNodeName) => { Object.keys(connections[sourceNodeName]).forEach((outputType) => { connections[sourceNodeName][outputType] = connections[sourceNodeName][outputType].map((outputArray: any[]) => outputArray.filter((conn: any) => conn.node !== nodeName), ); }); }); }); return { ok: true }; }
- src/index.ts:601-610 (handler)MCP server handler for the 'delete_node' tool call, delegates to N8nClient and formats response.private async handleDeleteNode(args: DeleteNodeRequest) { const result = await this.n8nClient.deleteNode(args); return { content: [ { type: 'text', text: JSON.stringify(jsonSuccess(result), null, 2), }, ], };
- src/index.ts:214-214 (registration)Tool registration in ListTools handler, defines name, description, and inline input schema.{ name: 'delete_node', description: 'Delete a node from an n8n workflow', inputSchema: { type: 'object', properties: { workflowId: { oneOf: [{ type: 'string' }, { type: 'number' }] }, nodeId: { type: 'string' } }, required: ['workflowId', 'nodeId'] } },
- src/types.ts:230-237 (schema)TypeScript interfaces defining the input request and output response for the delete_node tool.export interface DeleteNodeRequest { workflowId: string | number; nodeId: string; } export interface DeleteNodeResponse { ok: true; }
- src/index.ts:321-322 (handler)Dispatch handler in CallToolRequest switch statement that routes to handleDeleteNode.case 'delete_node': return await this.handleDeleteNode(request.params.arguments as unknown as DeleteNodeRequest);