Skip to main content
Glama

create-workflow

Set up new workflows in n8n by defining nodes and connections. Use compact JSON inputs to configure workflow structure, enabling automation and integration with n8n MCP Server.

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

  • MCP tool handler for 'create-workflow': validates arguments, retrieves N8nClient instance by clientId, and invokes client.createWorkflow() with provided name, nodes, and connections.
    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, specifying required clientId and name, optional nodes array and connections object.
    { 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"] } },
  • src/index.ts:397-851 (registration)
    Registration of all tools including 'create-workflow' in the ListToolsRequestSchema handler response.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "init-n8n", description: "Initialize connection to n8n instance. Use this tool whenever an n8n URL and API key are shared to establish the connection. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { url: { type: "string" }, apiKey: { type: "string" } }, required: ["url", "apiKey"] } }, { name: "list-workflows", description: "List all workflows from n8n. Use after init-n8n to see available workflows. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } }, { name: "get-workflow", description: "Retrieve a workflow by ID. Use after list-workflows to get detailed information about a specific workflow. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { 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"] } }, { name: "update-workflow", description: "Update an existing workflow in n8n. Use after get-workflow to modify a workflow's properties, nodes, or connections. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" }, workflow: { type: "object", properties: { name: { type: "string" }, active: { type: "boolean" }, nodes: { type: "array" }, connections: { type: "object" }, settings: { type: "object" } } } }, required: ["clientId", "id", "workflow"] } }, { name: "delete-workflow", description: "Delete a workflow by ID. This action cannot be undone. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "activate-workflow", description: "Activate a workflow by ID. This will enable the workflow to run. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "deactivate-workflow", description: "Deactivate a workflow by ID. This will prevent the workflow from running. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "list-projects", description: "List all projects from n8n. NOTE: Requires n8n Enterprise license with project management features enabled. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } }, { name: "create-project", description: "Create a new project in n8n. NOTE: Requires n8n Enterprise license with project management features enabled. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, name: { type: "string" } }, required: ["clientId", "name"] } }, { name: "delete-project", description: "Delete a project by ID. NOTE: Requires n8n Enterprise license with project management features enabled. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, projectId: { type: "string" } }, required: ["clientId", "projectId"] } }, { name: "update-project", description: "Update a project's name. NOTE: Requires n8n Enterprise license with project management features enabled. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, projectId: { type: "string" }, name: { type: "string" } }, required: ["clientId", "projectId", "name"] } }, { name: "list-users", description: "Retrieve all users from your instance. Only available for the instance owner.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } }, { name: "create-users", description: "Create one or more users in your instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, users: { type: "array", items: { type: "object", properties: { email: { type: "string" }, role: { type: "string", enum: ["global:admin", "global:member"] } }, required: ["email"] } } }, required: ["clientId", "users"] } }, { name: "get-user", description: "Get user by ID or email address.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, idOrEmail: { type: "string" } }, required: ["clientId", "idOrEmail"] } }, { name: "delete-user", description: "Delete a user from your instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, idOrEmail: { type: "string" } }, required: ["clientId", "idOrEmail"] } }, { name: "list-variables", description: "List all variables from n8n. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after init-n8n to see available variables. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" } }, required: ["clientId"] } }, { name: "create-variable", description: "Create a new variable in n8n. NOTE: Requires n8n Enterprise license with variable management features enabled. Variables can be used across workflows to store and share data. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, key: { type: "string" }, value: { type: "string" } }, required: ["clientId", "key", "value"] } }, { name: "delete-variable", description: "Delete a variable by ID. NOTE: Requires n8n Enterprise license with variable management features enabled. Use after list-variables to get the ID of the variable to delete. This action cannot be undone. IMPORTANT: Arguments must be provided as compact, single-line JSON without whitespace or newlines.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "create-credential", description: "Create a credential that can be used by nodes of the specified type. The credential type name can be found in the n8n UI when creating credentials (e.g., 'cloudflareApi', 'githubApi', 'slackOAuth2Api'). Use get-credential-schema first to see what fields are required for the credential type you want to create.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, name: { type: "string" }, type: { type: "string" }, data: { type: "object" } }, required: ["clientId", "name", "type", "data"] } }, { name: "delete-credential", description: "Delete a credential by ID. You must be the owner of the credentials.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "get-credential-schema", description: "Show credential data schema for a specific credential type. The credential type name can be found in the n8n UI when creating credentials (e.g., 'cloudflareApi', 'githubApi', 'slackOAuth2Api'). This will show you what fields are required for creating credentials of this type.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, credentialTypeName: { type: "string" } }, required: ["clientId", "credentialTypeName"] } }, // Execution Management Tools { name: "list-executions", description: "Retrieve all executions from your instance with optional filtering.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, includeData: { type: "boolean" }, status: { type: "string", enum: ["error", "success", "waiting"] }, workflowId: { type: "string" }, limit: { type: "number" } }, required: ["clientId"] } }, { name: "get-execution", description: "Retrieve a specific execution by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" }, includeData: { type: "boolean" } }, required: ["clientId", "id"] } }, { name: "delete-execution", description: "Delete a specific execution by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "number" } }, required: ["clientId", "id"] } }, // Tag Management Tools { name: "create-tag", description: "Create a new tag in your instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, name: { type: "string" } }, required: ["clientId", "name"] } }, { name: "list-tags", description: "Retrieve all tags from your instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, limit: { type: "number" } }, required: ["clientId"] } }, { name: "get-tag", description: "Retrieve a specific tag by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "update-tag", description: "Update a tag's name.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" }, name: { type: "string" } }, required: ["clientId", "id", "name"] } }, { name: "delete-tag", description: "Delete a tag by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } }, { name: "get-workflow-tags", description: "Get tags associated with a workflow.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, workflowId: { type: "string" } }, required: ["clientId", "workflowId"] } }, { name: "update-workflow-tags", description: "Update tags associated with a workflow.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, workflowId: { type: "string" }, tagIds: { type: "array", items: { type: "object", properties: { id: { type: "string" } }, required: ["id"] } } }, required: ["clientId", "workflowId", "tagIds"] } }, // Security Audit Tool { name: "generate-audit", description: "Generate a security audit for your n8n instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, daysAbandonedWorkflow: { type: "number" }, categories: { type: "array", items: { type: "string", enum: ["credentials", "database", "nodes", "filesystem", "instance"] } } }, required: ["clientId"] } } ] }; });
  • N8nClient helper method that performs the actual POST request to n8n API /workflows endpoint to create a new workflow.
    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, }, }), }); }

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

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