Skip to main content
Glama

delete_node

Remove a node from an n8n workflow by specifying the workflow ID and node ID to modify workflow structure.

Instructions

Delete a node from an n8n workflow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYes
workflowIdYes

Implementation Reference

  • src/index.ts:214-214 (registration)
    Registration of the 'delete_node' tool in the ListTools response, defining name, description, and 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'] } },
  • Dispatch from CallToolRequest handler switch to specific delete_node handler method.
    case 'delete_node': return await this.handleDeleteNode(request.params.arguments as unknown as DeleteNodeRequest);
  • MCP server wrapper handler: delegates to n8nClient.deleteNode and returns JSON response.
    private async handleDeleteNode(args: DeleteNodeRequest) { const result = await this.n8nClient.deleteNode(args); return { content: [ { type: 'text', text: JSON.stringify(jsonSuccess(result), null, 2), }, ], };
  • Core tool logic: atomically removes node from workflow.nodes array and cleans up all related connections (outgoing and incoming from other nodes) using optimistic concurrency control.
    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 };
  • TypeScript interfaces defining input parameters (workflowId, nodeId) and response for the delete_node tool.
    export interface DeleteNodeRequest { workflowId: string | number; nodeId: string; } export interface DeleteNodeResponse { ok: true; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/get2knowio/n8n-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server