import_n8n_workflow
Convert n8n workflow JSON into Agentled workflows by importing and creating draft versions for review before activation.
Instructions
Create a new Agentled workflow from an n8n JSON import.
Behavior:
runs deterministic import preview
creates workflow in preflight draft mode
stores imported contract for review/approval
does NOT auto-apply scaffold
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n8nJson | No | n8n workflow JSON object or string export | |
| workflow | No | Optional metadata overrides for the created workflow | |
| options | No | Optional import options | |
| locale | No | Locale for workflow creation (default en) |
Implementation Reference
- src/tools/workflows.ts:420-450 (handler)The registration and MCP handler for the 'import_n8n_workflow' tool. It delegates to the client's importN8nWorkflow method.
server.tool( 'import_n8n_workflow', `Create a new Agentled workflow from an n8n JSON import. Behavior: - runs deterministic import preview - creates workflow in preflight draft mode - stores imported contract for review/approval - does NOT auto-apply scaffold`, { n8nJson: z.any().describe('n8n workflow JSON object or string export'), workflow: z.object({ name: z.string().optional(), goal: z.string().optional(), description: z.string().optional(), pathname: z.string().optional(), }).optional().describe('Optional metadata overrides for the created workflow'), options: z.record(z.string(), z.any()).optional().describe('Optional import options'), locale: z.string().optional().describe('Locale for workflow creation (default en)'), }, async ({ n8nJson, workflow, options, locale }, extra) => { const client = clientFactory(extra); const result = await client.importN8nWorkflow(n8nJson, workflow, options, locale); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2), }], }; } ); - src/client.ts:386-396 (handler)The underlying implementation that performs the actual network request to the Agentled API to import an n8n workflow.
async importN8nWorkflow( n8nJson: string | Record<string, any>, workflow?: { name?: string; goal?: string; description?: string; pathname?: string }, options?: Record<string, any>, locale?: string ) { return this.request('/workflows/import/n8n/create', { method: 'POST', body: JSON.stringify({ n8nJson, workflow, options, locale }), }); }