Skip to main content
Glama

create-workflow

Set up a new workflow in MCP-N8N by defining nodes and connections. Requires compact JSON input with client ID, name, nodes, and connections for configuration.

Instructions

Create a new workflow in n8n. Use to set up a new workflow with optional nodes and connections. IMPORTANT: 1) Arguments must be provided as compact, single-line JSON without whitespace or newlines. 2) Must provide full workflow structure including nodes and connections arrays, even if empty. The 'active' property should not be included as it is read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
connectionsNo
nameYes
nodesNo

Implementation Reference

  • src/index.ts:436-448 (registration)
    Registration of the 'create-workflow' tool in the ListTools response, specifying name, description, and input schema.
      name: "create-workflow",
      description: "Create a new workflow in n8n. Use to set up a new workflow with optional nodes and connections. IMPORTANT: 1) Arguments must be provided as compact, single-line JSON without whitespace or newlines. 2) Must provide full workflow structure including nodes and connections arrays, even if empty. The 'active' property should not be included as it is read-only.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          name: { type: "string" },
          nodes: { type: "array" },
          connections: { type: "object" }
        },
        required: ["clientId", "name"]
      }
    },
  • Input schema for the 'create-workflow' tool defining parameters: clientId (required), name (required), nodes (optional array), connections (optional object).
    inputSchema: {
      type: "object",
      properties: {
        clientId: { type: "string" },
        name: { type: "string" },
        nodes: { type: "array" },
        connections: { type: "object" }
      },
      required: ["clientId", "name"]
    }
  • Main MCP CallTool handler for 'create-workflow': extracts arguments, retrieves N8nClient instance, calls createWorkflow method, handles success/error responses.
    case "create-workflow": {
      const { clientId, name, nodes = [], connections = {} } = args as {
        clientId: string;
        name: string;
        nodes?: any[];
        connections?: Record<string, any>;
      };
    
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const workflow = await client.createWorkflow(name, nodes, connections);
        return {
          content: [{
            type: "text",
            text: `Successfully created workflow:\n${JSON.stringify(workflow, null, 2)}`,
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • N8nClient.createWorkflow method: the core logic that performs POST request to /workflows endpoint with workflow name, nodes, connections, and default settings.
    async createWorkflow(name: string, nodes: any[] = [], connections: any = {}): Promise<N8nWorkflow> {
      return this.makeRequest<N8nWorkflow>('/workflows', {
        method: 'POST',
        body: JSON.stringify({
          name,
          nodes,
          connections,
          settings: {
            saveManualExecutions: true,
            saveExecutionProgress: true,
          },
        }),
      });
    }
  • TypeScript interface defining the structure of an N8n workflow object returned by the API.
    interface N8nWorkflow {
      id: number;
      name: string;
      active: boolean;
      createdAt: string;
      updatedAt: string;
      tags: string[];
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that 'active' is read-only and shouldn't be included, which is useful behavioral context. However, it lacks details on permissions needed, whether creation is idempotent, error handling, or what happens if invalid data is provided, leaving 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.

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. The two sentences earn their place by covering creation and critical formatting requirements, though the second sentence is a bit dense with multiple points (JSON format, structure, and 'active' property) that could be slightly better structured.

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

Completeness3/5

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

Given 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It adds value with formatting rules and the 'active' property note, but fails to explain parameter meanings, expected outputs, or error conditions, making it inadequate for safe and effective use without additional context.

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 0%, so the description must compensate. It mentions that arguments must be 'compact, single-line JSON' and require 'full workflow structure including nodes and connections arrays', adding context beyond the schema. However, it doesn't explain what 'clientId' or 'name' represent, or the structure of 'nodes' and 'connections', leaving key parameters semantically unclear.

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 resource ('in n8n'), specifying it's for setting up workflows with optional nodes and connections. It distinguishes from siblings like 'update-workflow' or 'delete-workflow' by focusing on creation, though it doesn't explicitly contrast with 'init-n8n' which might handle initial setup differently.

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 no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., after 'init-n8n'), contrast with 'update-workflow' for modifications, or specify use cases beyond 'set up a new workflow', leaving the agent to infer usage from the tool name alone.

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

Related 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/fellipesaraiva88/n8n-mcp-server'

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