Skip to main content
Glama

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
NameRequiredDescriptionDefault
workflowIdYes
nodeIdYes
xYes
yYes

Implementation Reference

  • Core implementation that finds the node by ID in the workflow, sets its position to [x, y], and atomically updates the workflow via performWorkflowUpdate
    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 }; }
  • MCP server tool handler that delegates set_node_position call to N8nClient and formats the 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 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'] } },
  • TypeScript interfaces defining the request and response shapes for setNodePosition
    export interface SetNodePositionRequest { workflowId: string | number; nodeId: string; x: number; y: number; } export interface SetNodePositionResponse { ok: true; }
  • Switch case dispatcher that routes set_node_position tool calls to the handler method
    case 'set_node_position': return await this.handleSetNodePosition(request.params.arguments as unknown as SetNodePositionRequest);

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