Skip to main content
Glama

n8n_create_workflow

Create automation workflows by defining nodes and connections. Specify workflow name, node array, and connection object to build and optionally activate workflows.

Instructions

Create a new automation workflow with nodes and connections. Provide workflow name, node array, and connection object. Optionally activate immediately. Returns new workflow with assigned ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesDescriptive workflow name
nodesYesArray of node objects with type, parameters, position
connectionsYesConnection map linking node outputs to inputs
activeNoStart workflow immediately (default: false)

Implementation Reference

  • The createWorkflow method in N8nClient class that executes the tool logic. It makes a POST request to the n8n API endpoint /api/v1/workflows with the workflow data (name, nodes, connections, active) serialized as JSON.
    async createWorkflow(workflow: any) {
      return this.request(`${this.apiBase}/workflows`, {
        method: 'POST',
        body: JSON.stringify(workflow),
      });
    }
  • The tool definition/schema for n8n_create_workflow. Defines the tool name, description, inputSchema with required properties (name, nodes, connections) and optional 'active' property, plus annotations for MCP capabilities.
      name: 'n8n_create_workflow',
      description: 'Create a new automation workflow with nodes and connections. Provide workflow name, node array, and connection object. Optionally activate immediately. Returns new workflow with assigned ID.',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Descriptive workflow name' },
          nodes: { type: 'array', description: 'Array of node objects with type, parameters, position' },
          connections: { type: 'object', description: 'Connection map linking node outputs to inputs' },
          active: { type: 'boolean', description: 'Start workflow immediately (default: false)' },
        },
        required: ['name', 'nodes', 'connections'],
      },
      annotations: {
        title: 'Create Workflow',
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true,
      },
    },
  • src/server.ts:22-30 (registration)
    The handleToolCall function routes tool calls to appropriate handlers. Line 29-30 shows n8n_create_workflow case delegating to client.createWorkflow(args).
    export async function handleToolCall(toolName: string, args: any, client: N8nClient): Promise<any> {
      switch (toolName) {
        // Workflow operations
        case 'n8n_list_workflows':
          return client.listWorkflows(args);
        case 'n8n_get_workflow':
          return client.getWorkflow(args.id);
        case 'n8n_create_workflow':
          return client.createWorkflow(args);
  • The private request method that handles all HTTP requests to the n8n API. Includes authentication via X-N8N-API-KEY header, timeout handling, and error response handling.
    private async request<T>(
      endpoint: string,
      options: RequestInit = {}
    ): Promise<T> {
      const url = `${this.config.apiUrl}${endpoint}`;
    
      const response = await fetch(url, {
        ...options,
        signal: AbortSignal.timeout(this.timeout),
        headers: {
          'X-N8N-API-KEY': this.config.apiKey,
          'Content-Type': 'application/json',
          ...options.headers,
        },
      });
    
      if (!response.ok) {
        const error = await response.text();
        throw new Error(`n8n API Error (${response.status}): ${error}`);
      }
    
      return response.json() as Promise<T>;
    }
Behavior4/5

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

Annotations provide readOnlyHint=false (indicating mutation), openWorldHint=true (suggesting flexibility), idempotentHint=false (non-idempotent), and destructiveHint=false (non-destructive). The description adds valuable context beyond this by specifying that it 'Returns new workflow with assigned ID' (output behavior) and mentions the optional activation feature, which is not covered by annotations. No contradictions with annotations exist.

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 front-loaded with the core purpose in the first sentence, followed by parameter summary and output details in subsequent sentences. Each sentence adds essential information without redundancy, making it efficient and well-structured for quick comprehension.

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

Completeness4/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), the description adequately covers the tool's purpose, inputs, and output behavior. However, it lacks details on error conditions, rate limits, or authentication requirements, which would be beneficial for a mutation tool with openWorldHint=true. The absence of an output schema makes the return value description ('Returns new workflow with assigned ID') particularly valuable.

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%, with each parameter clearly documented in the schema (e.g., 'Descriptive workflow name' for name). The description adds minimal value by summarizing parameters ('Provide workflow name, node array, and connection object') and noting the optional 'active' parameter, but does not provide additional semantic details beyond what the schema already offers.

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

Purpose5/5

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

The description clearly states the specific action ('Create a new automation workflow') and resource ('workflow'), distinguishing it from siblings like n8n_update_workflow (which modifies existing workflows) and n8n_get_workflow (which retrieves workflows). It specifies the creation involves 'nodes and connections', which differentiates it from simpler creation tools.

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

Usage Guidelines4/5

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

The description provides clear context for usage by listing required inputs (name, nodes, connections) and an optional parameter (active). However, it does not explicitly state when to use this tool versus alternatives like n8n_update_workflow or n8n_execute_workflow, nor does it mention any prerequisites or exclusions.

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/node2flow-th/n8n-management-mcp-community'

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