set_node_position
Position nodes within n8n workflows by specifying exact coordinates to organize workflow layouts and improve visual structure.
Instructions
Set the position of a node in an n8n workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | ||
| workflowId | Yes | ||
| x | Yes | ||
| y | Yes |
Implementation Reference
- src/n8n-client.ts:482-491 (handler)Core handler function that updates the node position in the workflow by fetching the current workflow, modifying the node's position array, and saving via optimistic concurrency with ETag.async 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-622 (handler)MCP server handler that delegates to N8nClient.setNodePosition and formats the JSON response.private 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 response, defining 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 set_node_position.export interface SetNodePositionRequest { workflowId: string | number; nodeId: string; x: number; y: number; } export interface SetNodePositionResponse { ok: true; }