Skip to main content
Glama

create-workflow

Create new n8n workflows with nodes and connections. Set up automation processes through the MCP server interface.

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
nameYes
nodesNo
connectionsNo

Implementation Reference

  • MCP tool handler for 'create-workflow' in the CallToolRequestSchema switch statement. Validates client, calls N8nClient.createWorkflow, and returns success or error response.
    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
        };
      }
    }
  • Input schema definition for the 'create-workflow' tool, listed in the ListToolsRequestSchema response.
      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"]
      }
    },
  • N8nClient.createWorkflow method: core implementation that sends POST request to n8n /api/v1/workflows endpoint with workflow data.
    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,
          },
        }),
      });
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/5.0
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.