Skip to main content
Glama

n8n_create_workflow

Create new n8n workflows with nodes and connections for automation tasks. Build workflows in inactive state for testing before activation.

Instructions

Create a new workflow with nodes and connections. The workflow will be created in inactive state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the workflow
nodesYesArray of node objects. Each node needs: id, name, type, typeVersion, position [x,y], parameters
connectionsYesConnection mapping between nodes. Format: { "sourceNode": { "main": [[{ "node": "targetNode", "type": "main", "index": 0 }]] } }
settingsNoOptional workflow settings

Implementation Reference

  • The handler function that executes the n8n_create_workflow tool. Validates input parameters and uses N8nApiClient to create the workflow, returning success details.
    n8n_create_workflow: async (
      client: N8nApiClient,
      args: Record<string, unknown>
    ): Promise<ToolResult> => {
      const name = args.name as string;
      const nodes = args.nodes as N8nNode[];
      const connections = args.connections as N8nConnections;
      const settings = args.settings as N8nWorkflowSettings | undefined;
    
      if (!name) {
        throw new Error('Workflow name is required');
      }
      if (!nodes || !Array.isArray(nodes)) {
        throw new Error('Nodes array is required');
      }
      if (!connections) {
        throw new Error('Connections object is required');
      }
    
      const workflow = await client.createWorkflow({
        name,
        nodes,
        connections,
        settings,
      });
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify({
              success: true,
              message: `Workflow "${workflow.name}" created successfully`,
              workflow: {
                id: workflow.id,
                name: workflow.name,
                active: workflow.active,
                nodeCount: workflow.nodes.length,
              },
            }, null, 2),
          },
        ],
      };
    },
  • ToolDefinition for n8n_create_workflow including name, description, and detailed inputSchema for validation.
    {
      name: 'n8n_create_workflow',
      description: 'Create a new workflow with nodes and connections. The workflow will be created in inactive state.',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the workflow',
          },
          nodes: {
            type: 'array',
            description: 'Array of node objects. Each node needs: id, name, type, typeVersion, position [x,y], parameters',
            items: {
              type: 'object',
              properties: {
                id: { type: 'string' },
                name: { type: 'string' },
                type: { type: 'string', description: 'e.g., "n8n-nodes-base.webhook", "n8n-nodes-base.httpRequest"' },
                typeVersion: { type: 'number' },
                position: { type: 'array', items: { type: 'number' } },
                parameters: { type: 'object' },
              },
              required: ['id', 'name', 'type', 'typeVersion', 'position', 'parameters'],
            },
          },
          connections: {
            type: 'object',
            description: 'Connection mapping between nodes. Format: { "sourceNode": { "main": [[{ "node": "targetNode", "type": "main", "index": 0 }]] } }',
          },
          settings: {
            type: 'object',
            description: 'Optional workflow settings',
            properties: {
              executionOrder: { type: 'string', enum: ['v0', 'v1'] },
              timezone: { type: 'string' },
            },
          },
        },
        required: ['name', 'nodes', 'connections'],
      },
  • src/server.ts:122-125 (registration)
    MCP server registration and dispatching logic for workflow tools, including n8n_create_workflow handler.
    if (name in workflowToolHandlers) {
      const handler = workflowToolHandlers[name as keyof typeof workflowToolHandlers];
      return handler(client, args);
    }
  • Aggregation of all tool definitions including n8n_create_workflow schema into allTools array used by MCP server.
    export const allTools: ToolDefinition[] = [
      ...documentationTools,  // Documentation first for discoverability
      ...workflowTools,
      ...executionTools,
    ];
  • N8nApiClient method that performs the actual HTTP POST to create the workflow, called by the tool handler.
    async createWorkflow(workflow: {
      name: string;
      nodes: N8nNode[];
      connections: N8nConnections;
      settings?: N8nWorkflowSettings;
    }): Promise<N8nWorkflow> {
      return this.request<N8nWorkflow>('/workflows', {
        method: 'POST',
        body: JSON.stringify(workflow),
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the workflow is created 'in inactive state,' which adds some context about the initial state. However, it lacks critical details such as required permissions, whether this is a destructive operation (e.g., overwriting existing workflows), error handling, or what the response looks like (since there's no output schema). For a creation tool with zero annotation coverage, this is insufficient.

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

Conciseness4/5

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

The description is concise with two sentences that directly state the purpose and a key behavioral trait (inactive state). It's front-loaded with the main action and avoids unnecessary fluff. However, it could be slightly more structured by explicitly separating purpose from usage notes, but it remains efficient.

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 complexity (4 parameters with nested objects, no output schema, and no annotations), the description is incomplete. It lacks details on behavioral aspects like permissions, error cases, or response format, and doesn't fully guide usage relative to sibling tools. For a creation tool with significant complexity and no structured support, more comprehensive guidance is needed.

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?

The schema description coverage is 100%, meaning the input schema already documents all parameters (name, nodes, connections, settings) thoroughly. The description doesn't add any meaningful semantic details beyond what's in the schema, such as examples or constraints not captured in the schema. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 ('Create a new workflow') and the resource ('with nodes and connections'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this from sibling tools like 'n8n_update_workflow' or 'n8n_list_workflows', which would require mentioning it's for initial creation rather than modification or retrieval.

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 noting the workflow 'will be created in inactive state,' which hints at a prerequisite (activation might be needed later). However, it doesn't specify when to use this tool versus alternatives like 'n8n_update_workflow' for modifications or 'n8n_activate_workflow' for activation, nor does it mention any exclusions or prerequisites beyond the implied inactive state.

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/alicankiraz1/cursor-n8n-builder'

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