Skip to main content
Glama

create_workflow

Build n8n workflows from JSON to test automation processes in a secure environment without credential exposure.

Instructions

Create a new n8n workflow from JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowYes

Implementation Reference

  • The core handler function that creates a new n8n workflow by making a POST request to the n8n API with the workflow JSON payload.
    export async function createWorkflow(workflow: Record<string, unknown>) {
      const { baseUrl } = getEnv();
      const response = await fetch(`${baseUrl}/api/v1/workflows`, {
        method: 'POST',
        headers: buildHeaders(),
        body: JSON.stringify(workflow),
      });
      if (!response.ok) throw new Error(`n8n API returned ${response.status}`);
      return (await response.json()) as any;
    }
  • src/index.ts:49-57 (registration)
    Tool registration defining the 'create_workflow' tool with its name, description, and JSON Schema for input validation.
    {
      name: 'create_workflow',
      description: 'Create a new n8n workflow from JSON.',
      inputSchema: {
        type: 'object',
        properties: { workflow: { type: 'object' } },
        required: ['workflow'],
      },
    },
  • Request handler that dispatches 'create_workflow' tool calls, validates input using Zod schema, invokes the createWorkflow function, and returns the result.
    if (name === 'create_workflow') {
      const { workflow } = z.object({ workflow: z.record(z.unknown()) }).parse(args);
      const created = await createWorkflow(workflow);
      return { content: [{ type: 'text', text: JSON.stringify(created, null, 2) }] };
    }
  • Helper function that builds HTTP headers including the n8n API key for authentication when making API requests.
    function buildHeaders() {
      const { apiKey } = getEnv();
      return {
        'Content-Type': 'application/json',
        'X-N8N-API-KEY': apiKey,
      };
    }
Behavior2/5

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

With no annotations, the description carries the full burden but only states the basic action without disclosing behavioral traits like permissions needed, whether the workflow is immediately active, error handling, or response format. It mentions JSON input but doesn't elaborate on structure or constraints.

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 a single, efficient sentence with zero waste, front-loading the key action and resource appropriately. Every word earns its place.

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 the complexity (creation tool with nested object parameter, no annotations, no output schema), the description is incomplete. It lacks details on input format, behavioral expectations, and output, leaving significant gaps for an AI agent to use it correctly.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but only vaguely references 'JSON' without explaining the 'workflow' object's structure, required fields, or examples. This adds minimal meaning beyond the bare 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 action ('Create') and resource ('new n8n workflow from JSON'), making the purpose unambiguous. It distinguishes from siblings like 'update_workflow' or 'delete_workflow' by specifying creation, though it doesn't explicitly contrast with them.

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?

No guidance is provided on when to use this tool versus alternatives like 'update_workflow' or prerequisites. The description implies usage for initial workflow creation but lacks explicit context 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/Souzix76/n8n-workflow-tester-safe'

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