Skip to main content
Glama

add_node

Add functional n8n nodes to workflows by specifying file path, node configuration, and positioning for enhanced automation development.

Instructions

Add a REAL n8n node to workflow (no mock/placeholder nodes allowed)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the workflow file
nodeYesThe node to add
positionNoPosition for the new node

Implementation Reference

  • Core implementation of the add_node tool: reads workflow JSON, appends the provided node (with auto-positioning if not specified), persists changes to file, returns success message.
    export async function addNodeToWorkflow(
      workflowsPath: string,
      workflowPath: string,
      node: any,
      position?: any
    ): Promise<any> {
      try {
        const fullPath = path.join(workflowsPath, workflowPath);
        const content = await fs.readFile(fullPath, 'utf-8');
        const workflow = JSON.parse(content);
    
        if (!workflow.nodes) {
          workflow.nodes = [];
        }
    
        if (position) {
          node.position = [position.x || 250, position.y || 300];
        } else {
          const lastNode = workflow.nodes[workflow.nodes.length - 1];
          if (lastNode && lastNode.position) {
            node.position = [lastNode.position[0] + 250, lastNode.position[1]];
          } else {
            node.position = [250, 300];
          }
        }
    
        workflow.nodes.push(node);
    
        await fs.writeFile(fullPath, JSON.stringify(workflow, null, 2));
    
        return {
          content: [
            {
              type: 'text',
              text: `Node added to workflow: ${node.id}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to add node: ${error}`);
      }
    }
  • ToolHandler switch case that routes 'add_node' tool invocations to the addNodeToWorkflow implementation, passing workflowsPath and parsed arguments.
    case 'add_node':
      return await addNodeToWorkflow(
        this.workflowsPath,
        args?.path as string,
        args?.node as any,
        args?.position as any
      );
  • Registers the 'add_node' MCP tool including its name, description, and input schema validation.
    {
      name: 'add_node',
      description: 'Add a REAL n8n node to workflow (no mock/placeholder nodes allowed)',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Path to the workflow file',
          },
          node: {
            type: 'object',
            description: 'The node to add',
          },
          position: {
            type: 'object',
            properties: {
              x: { type: 'number' },
              y: { type: 'number' },
            },
            description: 'Position for the new node',
          },
        },
        required: ['path', 'node'],
      },
    },
  • Input schema defining parameters for add_node: path (required), node (required), optional position with x/y coordinates.
    inputSchema: {
      type: 'object',
      properties: {
        path: {
          type: 'string',
          description: 'Path to the workflow file',
        },
        node: {
          type: 'object',
          description: 'The node to add',
        },
        position: {
          type: 'object',
          properties: {
            x: { type: 'number' },
            y: { type: 'number' },
          },
          description: 'Position for the new node',
        },
      },
      required: ['path', 'node'],
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions that only 'REAL' nodes are allowed, hinting at a validation or restriction, but doesn't cover critical aspects like permissions needed, whether it modifies existing workflows destructively, error handling, or response format. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and includes a necessary constraint ('no mock/placeholder nodes allowed'), making it appropriately sized and structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 3 parameters, no output schema, and no annotations), the description is incomplete. It lacks details on behavioral traits, error cases, or what happens post-addition (e.g., workflow state changes). For a tool that modifies workflows, more context is needed to ensure safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (path, node, position). The description adds no additional meaning about these parameters, such as what constitutes a valid 'node' object or how 'position' coordinates work. Baseline 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add') and resource ('REAL n8n node to workflow'), specifying it's not for mock/placeholder nodes. However, it doesn't explicitly differentiate from sibling tools like 'create' or 'update', which might also involve workflow modifications, leaving some ambiguity about uniqueness.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance by stating 'no mock/placeholder nodes allowed', which implies a usage constraint but doesn't explain when to use this tool versus alternatives like 'create' or 'update'. No explicit when/when-not scenarios or sibling tool comparisons are included.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mckinleymedia/mcflow-mcp'

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