Skip to main content
Glama

generate

Create n8n workflows from templates using real nodes. Specify template type and workflow name to generate functional automation workflows without mock components.

Instructions

Generate a workflow from template using REAL n8n nodes (no mock/placeholder nodes). IMPORTANT: Use dashes in filenames, not underscores

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYesTemplate type to use
nameYesWorkflow name (use dashes, not underscores)
projectNoOptional project name (only for multi-project repos)
configNoConfiguration options for the template

Implementation Reference

  • The core handler function that implements the 'generate' tool logic. It defines predefined workflow templates with real n8n nodes (webhook-api, scheduled-report), sets positions and connections, and creates the workflow via WorkflowManager.
    export async function generateWorkflowFromTemplate(
      workflowManager: WorkflowManager,
      template: string,
      project: string,
      name: string,
      config: any = {}
    ): Promise<any> {
      const templates: { [key: string]: any } = {
        'webhook-api': {
          name: project ? `${project} - ${name}` : name,
          nodes: [
            {
              id: 'webhook-trigger',
              name: 'Webhook',
              type: 'n8n-nodes-base.webhook',
              typeVersion: 1,
              position: NodePositioning.getHorizontalPosition(0),
              parameters: {
                path: config.webhookPath || `/${name}`,
                responseMode: 'onReceived',
                responseData: 'allEntries',
                options: {},
              },
            },
            {
              id: 'process-data',
              name: 'Process Data',
              type: 'n8n-nodes-base.code',
              typeVersion: 2,
              position: NodePositioning.getHorizontalPosition(1),
              parameters: {
                language: 'javaScript',
                jsCode: config.processCode || '// Process the incoming data\nreturn $input.all();',
              },
            },
            {
              id: 'respond',
              name: 'Respond',
              type: 'n8n-nodes-base.respondToWebhook',
              typeVersion: 1,
              position: NodePositioning.getHorizontalPosition(2),
              parameters: {
                respondWith: 'json',
                responseBody: '={{ $json }}',
              },
            },
          ],
          connections: {
            'webhook-trigger': {
              main: [[{ node: 'process-data', type: 'main', index: 0 }]],
            },
            'process-data': {
              main: [[{ node: 'respond', type: 'main', index: 0 }]],
            },
          },
        },
        'scheduled-report': {
          name: `${project} - ${name}`,
          nodes: [
            {
              id: 'schedule-trigger',
              name: 'Schedule',
              type: 'n8n-nodes-base.scheduleTrigger',
              typeVersion: 1,
              position: NodePositioning.getVerticalPosition(0),
              parameters: {
                rule: {
                  interval: [
                    {
                      field: 'hours',
                      hoursInterval: config.hoursInterval || 24,
                    },
                  ],
                },
              },
            },
            {
              id: 'gather-data',
              name: 'Gather Data',
              type: 'n8n-nodes-base.httpRequest',
              typeVersion: 4.2,
              position: [500, 300],
              parameters: {
                url: config.dataUrl || 'https://api.example.com/data',
                method: 'GET',
              },
            },
            {
              id: 'format-report',
              name: 'Format Report',
              type: 'n8n-nodes-base.code',
              typeVersion: 2,
              position: [750, 300],
              parameters: {
                language: 'javaScript',
                jsCode: '// Format the report\nreturn { report: $input.all() };',
              },
            },
          ],
          connections: {
            'schedule-trigger': {
              main: [[{ node: 'gather-data', type: 'main', index: 0 }]],
            },
            'gather-data': {
              main: [[{ node: 'format-report', type: 'main', index: 0 }]],
            },
          },
        },
      };
    
      const workflowTemplate = templates[template];
      if (!workflowTemplate) {
        throw new Error(`Unknown template: ${template}`);
      }
    
      return await workflowManager.createWorkflow(name, workflowTemplate, project);
    }
  • Defines the input schema, parameters, description, and enum values for the 'generate' tool.
    name: 'generate',
    description: 'Generate a workflow from template using REAL n8n nodes (no mock/placeholder nodes). IMPORTANT: Use dashes in filenames, not underscores',
    inputSchema: {
      type: 'object',
      properties: {
        template: {
          type: 'string',
          enum: ['webhook-api', 'scheduled-report', 'data-sync', 'error-handler', 'approval-flow'],
          description: 'Template type to use',
        },
        name: {
          type: 'string',
          description: 'Workflow name (use dashes, not underscores)',
        },
        project: {
          type: 'string',
          description: 'Optional project name (only for multi-project repos)',
        },
        config: {
          type: 'object',
          description: 'Configuration options for the template',
        },
      },
      required: ['template', 'name'],
    },
  • Registers and dispatches the 'generate' tool call to the implementation function generateWorkflowFromTemplate.
    case 'generate':
      return await generateWorkflowFromTemplate(
        this.workflowManager,
        args?.template as string,
        args?.project as string,
        args?.name as string,
        args?.config as any
      );
  • MCP server registration: provides tool definitions (including 'generate') via ListToolsRequestSchema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: getToolDefinitions(),
    }));
  • MCP server handler: routes tool calls (including 'generate') to ToolHandler.handleTool for execution.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      return await this.toolHandler.handleTool(
        request.params.name,
        request.params.arguments
      );
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions using 'REAL n8n nodes' and filename formatting rules, but lacks critical information: whether this is a read or write operation, what permissions are needed, how the generated workflow is stored/accessed, error handling, or rate limits. For a tool that likely creates workflows, this is insufficient behavioral context.

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 brief with two sentences. The first sentence states the core purpose, and the second provides a critical formatting rule. However, the IMPORTANT formatting note might be better placed in the parameter description rather than the tool description, slightly reducing efficiency.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a tool with 4 parameters (including a nested object) that likely performs workflow generation. It doesn't explain what happens after generation, how to access the result, error conditions, or integration with other tools. The description focuses on technical constraints rather than comprehensive usage 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 100%, so the schema already documents all parameters thoroughly. The description adds marginal value by reinforcing the 'name' parameter's formatting requirement ('use dashes, not underscores'), which is already in the schema description. No additional parameter meaning or usage context is provided beyond what's in the structured schema.

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 verb ('generate') and resource ('workflow from template'), specifying it uses 'REAL n8n nodes (no mock/placeholder nodes)'. However, it doesn't explicitly differentiate from sibling tools like 'create', 'create_module', or 'generate_app', which might have overlapping functionality in workflow creation.

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 like 'create' or 'generate_app'. It includes an IMPORTANT note about filename formatting, but this is a technical constraint rather than usage context. There's no mention of prerequisites, scenarios, or exclusions for this tool.

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/mckinleymedia/mcflow-mcp'

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