Skip to main content
Glama

add_node_to_workflow

Append a node to an existing n8n workflow for testing and inspection purposes within a safe environment.

Instructions

Append a node JSON object to an existing workflow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowIdYes
nodeYes

Implementation Reference

  • The core implementation function that adds a node to a workflow by fetching the workflow, appending the node to the nodes array, and updating the workflow via n8n API.
    export async function addNodeToWorkflow(workflowId: string, node: Record<string, unknown>) {
      const workflow = await getWorkflow(workflowId);
      const nodes = Array.isArray(workflow.nodes) ? workflow.nodes : [];
      workflow.nodes = [...nodes, node];
      return await updateWorkflow(workflowId, workflow);
    }
  • src/index.ts:77-84 (registration)
    Tool registration defining the tool name, description, and input schema with workflowId (string) and node (object) as required parameters.
      name: 'add_node_to_workflow',
      description: 'Append a node JSON object to an existing workflow.',
      inputSchema: {
        type: 'object',
        properties: { workflowId: { type: 'string' }, node: { type: 'object' } },
        required: ['workflowId', 'node'],
      },
    },
  • Request handler that validates input arguments using Zod schema, calls the addNodeToWorkflow function, and returns the result as JSON text.
    if (name === 'add_node_to_workflow') {
      const { workflowId, node } = z.object({ workflowId: z.string(), node: z.record(z.unknown()) }).parse(args);
      const updated = await addNodeToWorkflow(workflowId, node);
      return { content: [{ type: 'text', text: JSON.stringify(updated, null, 2) }] };
    }

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/Souzix76/n8n-workflow-tester-safe'

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