import_workflow
Import workflow configurations from JSON exports to recreate them in new environments with fresh IDs and recorded provenance. Use to transfer workflows between different MCP server instances.
Instructions
Import a workflow from an export JSON into this workspace. Accepts the full WorkflowExport object (from export_workflow) and creates a new workflow with fresh IDs. Associated pages are recreated. Import provenance is recorded in the workflow metadata.
Use this together with export_workflow to move workflows between environments. Tip: register separate MCP servers for sandbox and prod, export from one, import into the other.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exportJson | Yes | The WorkflowExport object (output from export_workflow) | |
| locale | No | Locale for the imported workflow (default: en) |
Implementation Reference
- src/tools/workflows.ts:376-385 (handler)The handler function for import_workflow, which calls the client's importWorkflow method.
async ({ exportJson, locale }, extra) => { const client = clientFactory(extra); const result = await client.importWorkflow(exportJson, locale); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2), }], }; } - src/tools/workflows.ts:364-386 (registration)Registration of the import_workflow tool with schema definition.
server.tool( 'import_workflow', `Import a workflow from an export JSON into this workspace. Accepts the full WorkflowExport object (from export_workflow) and creates a new workflow with fresh IDs. Associated pages are recreated. Import provenance is recorded in the workflow metadata. Use this together with export_workflow to move workflows between environments. Tip: register separate MCP servers for sandbox and prod, export from one, import into the other.`, { exportJson: z.record(z.string(), z.any()).describe('The WorkflowExport object (output from export_workflow)'), locale: z.string().optional().describe('Locale for the imported workflow (default: en)'), }, async ({ exportJson, locale }, extra) => { const client = clientFactory(extra); const result = await client.importWorkflow(exportJson, locale); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2), }], }; } ); - src/client.ts:293-298 (helper)The actual API client method that performs the network request for importing a workflow.
async importWorkflow(exportData: Record<string, any>, locale?: string) { return this.request('/workflows/import', { method: 'POST', body: JSON.stringify({ export: exportData, locale }), }); }