set_node_position
Reposition nodes within n8n workflows by specifying exact coordinates to organize workflow layouts effectively.
Instructions
Set the position of a node in an n8n workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflowId | Yes | ||
| nodeId | Yes | ||
| x | Yes | ||
| y | Yes |
Implementation Reference
- src/n8n-client.ts:482-491 (handler)Core implementation that finds the node by ID in the workflow, sets its position to [x, y], and atomically updates the workflow via performWorkflowUpdateasync setNodePosition(request: SetNodePositionRequest): Promise<SetNodePositionResponse> { 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}`); } workflow.nodes[nodeIndex].position = [request.x, request.y]; }); return { ok: true }; }
- src/index.ts:613-623 (handler)MCP server tool handler that delegates set_node_position call to N8nClient and formats the responseprivate async handleSetNodePosition(args: SetNodePositionRequest) { const result = await this.n8nClient.setNodePosition(args); return { content: [ { type: 'text', text: JSON.stringify(jsonSuccess(result), null, 2), }, ], }; }
- src/index.ts:215-215 (registration)Tool registration in listTools handler including name, description, and input schema{ name: 'set_node_position', description: 'Set the position of a node in an n8n workflow', inputSchema: { type: 'object', properties: { workflowId: { oneOf: [{ type: 'string' }, { type: 'number' }] }, nodeId: { type: 'string' }, x: { type: 'number' }, y: { type: 'number' } }, required: ['workflowId', 'nodeId', 'x', 'y'] } },
- src/types.ts:239-248 (schema)TypeScript interfaces defining the request and response shapes for setNodePositionexport interface SetNodePositionRequest { workflowId: string | number; nodeId: string; x: number; y: number; } export interface SetNodePositionResponse { ok: true; }
- src/index.ts:323-324 (handler)Switch case dispatcher that routes set_node_position tool calls to the handler methodcase 'set_node_position': return await this.handleSetNodePosition(request.params.arguments as unknown as SetNodePositionRequest);