Skip to main content
Glama
ifmelate

n8n-workflow-builder-mcp

by ifmelate

create_workflow

Build and store new workflows by specifying a workflow name and project directory, enabling efficient process automation with n8n.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_nameYesThe name for the new workflow
workspace_dirYesAbsolute path to the project root directory where workflow_data will be stored

Implementation Reference

  • The core handler function that implements the create_workflow tool logic. It logs security event, generates UUID, builds initial n8n workflow JSON structure, determines file path, saves via workflowStorage, and returns workflow ID, data, and path.
    const createWorkflowExecute = async (params) => {
        const { name, workflow_filename, description = '', active = false, settings = {}, userId } = params;
    
        // Security logging
        logSecurityEvent({
            level: 'info',
            eventType: 'workflow_create',
            userId: userId || 'anonymous',
            details: {
                name,
                active,
                workflow_filename
            }
        });
    
        // Generate a unique ID for the workflow
        const workflowId = uuidv4();
    
        // Create basic workflow structure
        const workflow = {
            id: workflowId,
            name,
            description,
            active,
            createdAt: new Date().toISOString(),
            updatedAt: new Date().toISOString(),
            settings: {
                saveExecutionProgress: true,
                saveManualExecutions: true,
                saveDataErrorExecution: 'all',
                saveDataSuccessExecution: 'all',
                executionTimeout: 3600,
                ...settings
            },
            nodes: [],
            connections: {},
            pinData: {},
            staticData: null,
            tags: []
        };
    
        // Determine the file path
        let filePath;
        if (workflow_filename) {
            // Ensure filename ends with .json
            const filename = workflow_filename.endsWith('.json') ? workflow_filename : `${workflow_filename}.json`;
            filePath = path.join(DEFAULT_WORKFLOW_DIR, filename);
        } else {
            filePath = path.join(DEFAULT_WORKFLOW_DIR, `${workflowId}.json`);
        }
    
        // Save the workflow
        await workflowStorage.saveWorkflow(workflowId, workflow, filePath);
    
        logger.info(`Created new workflow: ${name} (${workflowId}) at ${filePath}`);
    
        return {
            workflowId,
            workflowData: workflow,
            filePath
        };
    };
  • Schema and definition for the 'workflow_create' tool, including input parameters (name required, others optional) and output structure (workflowId, workflowData, filePath). Note: this is in individualToolDefinitions, may be for reference.
    workflow_create: {
        name: 'workflow_create',
        description: 'Create a new workflow',
        execute: createWorkflowExecute,
        input_schema: {
            type: 'object',
            properties: {
                name: {
                    type: 'string',
                    description: 'Name of the workflow'
                },
                workflow_filename: {
                    type: 'string',
                    description: 'Custom filename for the workflow (optional)'
                },
                description: {
                    type: 'string',
                    description: 'Description of the workflow'
                },
                active: {
                    type: 'boolean',
                    description: 'Whether the workflow should be active'
                },
                settings: {
                    type: 'object',
                    description: 'Workflow settings'
                }
            },
            required: ['name']
        },
        output_schema: {
            type: 'object',
            properties: {
                workflowId: {
                    type: 'string',
                    description: 'ID of the created workflow'
                },
                workflowData: {
                    type: 'object',
                    description: 'Full workflow data'
                },
                filePath: {
                    type: 'string',
                    description: 'Path where the workflow file was saved'
                }
            }
        }
    },
  • In the 'workflow_manage' tool, the 'create' operation is registered to call createWorkflowExecute with the rest of parameters. This provides create_workflow functionality within the consolidated workflow_manage tool.
    execute: async (params) => {
        const { operation, ...rest } = params;
    
        // Route to appropriate handler based on operation
        switch (operation) {
            case 'create':
                return createWorkflowExecute(rest);
            case 'save':
                return saveWorkflowExecute(rest);
            case 'load':
                return loadWorkflowExecute(rest);
            case 'list':
                return listWorkflowsExecute(rest);
            case 'delete':
                return deleteWorkflowExecute(rest);
            case 'generate':
                return generateWorkflow(rest);
            default:
                throw new Error(`Unknown workflow operation: ${operation}`);
        }
  • Registers 'create' operation/tool as createWorkflowTool (imported from workflowCreation.js) within workflowTools object, likely for internal or alternative tool grouping.
    const workflowTools = {
        create: createWorkflowTool,
        save: workflowStorageTools.saveWorkflowTool,
        load: workflowStorageTools.loadWorkflowTool,
        list: workflowStorageTools.listWorkflowsTool,
        delete: workflowStorageTools.deleteWorkflowTool,
        generate: generateWorkflowTool
  • Exports the createWorkflowExecute handler for use in tool definitions and registrations.
    module.exports = {
        createWorkflowExecute
    }; 
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/ifmelate/n8n-workflow-builder-mcp'

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