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, }, }), }); }

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