Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
exportJsonYesThe WorkflowExport object (output from export_workflow)
localeNoLocale for the imported workflow (default: en)

Implementation Reference

  • 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),
            }],
        };
    }
  • 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),
                    }],
                };
            }
        );
  • 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 }),
        });
    }

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/Agentled/mcp-server'

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