Skip to main content
Glama

create_node

Add a new node to an existing n8n workflow, specifying type, parameters, and position for workflow automation.

Instructions

Create a new node in an existing n8n workflow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowIdYesThe workflow ID
typeYesThe node type (e.g., n8n-nodes-base.webhook)
nameNoOptional name for the node
paramsNoOptional node parameters
positionNoOptional [x, y] position
credentialsNoOptional credentials configuration

Implementation Reference

  • Core handler implementation in N8nClient that generates a node ID, computes default position if needed, constructs the new node object, and atomically appends it to the workflow's nodes array via performWorkflowUpdate.
    async createNode(request: CreateNodeRequest): Promise<CreateNodeResponse> { const nodeId = this.generateNodeId(); await this.performWorkflowUpdate(request.workflowId, (workflow) => { const position = request.position || this.getDefaultPosition(workflow.nodes); const newNode: N8nNode = { id: nodeId, name: request.name || request.type.split('.').pop() || 'New Node', type: request.type, typeVersion: 1, position, parameters: request.params || {}, credentials: request.credentials || {}, }; workflow.nodes.push(newNode); }); return { nodeId }; }
  • MCP server tool handler that receives the tool call, delegates to N8nClient.createNode, and formats the success response as MCP content.
    private async handleCreateNode(args: CreateNodeRequest) { const result = await this.n8nClient.createNode(args); return { content: [ { type: 'text', text: JSON.stringify(jsonSuccess(result), null, 2), }, ], }; }
  • src/index.ts:211-211 (registration)
    Tool registration in the MCP server's ListTools response, defining the tool name, description, and JSON schema for input validation.
    { name: 'create_node', description: 'Create a new node in an existing n8n workflow', inputSchema: { type: 'object', properties: { workflowId: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'The workflow ID' }, type: { type: 'string', description: 'The node type (e.g., n8n-nodes-base.webhook)' }, name: { type: 'string', description: 'Optional name for the node' }, params: { type: 'object', description: 'Optional node parameters' }, position: { type: 'array', items: { type: 'number' }, minItems: 2, maxItems: 2, description: 'Optional [x, y] position' }, credentials: { type: 'object', description: 'Optional credentials configuration' } }, required: ['workflowId', 'type'] } },
  • TypeScript interface defining the input parameters for create_node, used in handlers and registration.
    export interface CreateNodeRequest { workflowId: string | number; type: string; name?: string; params?: Record<string, any>; position?: [number, number]; credentials?: Record<string, string>; }
  • TypeScript interface defining the output of create_node, containing the generated node ID.
    export interface CreateNodeResponse { nodeId: string; }

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