Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

Export Workflow JSON

n8n_export_workflow
Read-onlyIdempotent

Export n8n workflows as JSON files for backup purposes or to transfer them between different n8n instances.

Instructions

Export a workflow as JSON for backup or import elsewhere.

Args:

  • id (string): Workflow ID to export

Returns: Complete workflow JSON that can be imported into another n8n instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWorkflow ID to export

Implementation Reference

  • The implementation of the `n8n_export_workflow` tool, which retrieves a workflow by ID, sanitizes it by removing instance-specific fields, and returns the JSON.
      server.registerTool(
        'n8n_export_workflow',
        {
          title: 'Export Workflow JSON',
          description: `Export a workflow as JSON for backup or import elsewhere.
    
    Args:
      - id (string): Workflow ID to export
    
    Returns:
      Complete workflow JSON that can be imported into another n8n instance.`,
          inputSchema: z.object({
            id: z.string().min(1).describe('Workflow ID to export')
          }).strict(),
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false
          }
        },
        async (params: { id: string }) => {
          const workflow = await get<Record<string, unknown>>(`/workflows/${params.id}`);
          
          // Remove instance-specific fields for export
          const exportable = { ...workflow };
          delete exportable.id;
          delete exportable.createdAt;
          delete exportable.updatedAt;
          delete exportable.versionId;
          
          const json = JSON.stringify(exportable, null, 2);
          
          return {
            content: [{ type: 'text', text: `**Exported Workflow: ${(workflow as { name?: string }).name || params.id}**\n\n\`\`\`json\n${json}\n\`\`\`` }],
            structuredContent: exportable
          };
        }
      );
Behavior4/5

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

Annotations already declare this as read-only, non-destructive, idempotent, and closed-world, covering core safety traits. The description adds valuable context by specifying the output format ('Complete workflow JSON that can be imported into another n8n instance'), which helps the agent understand the tool's behavior beyond annotations. However, it doesn't mention potential errors (e.g., invalid ID) or rate limits.

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 efficiently structured with a clear purpose statement, a dedicated 'Args' section listing the single parameter, and a 'Returns' section explaining the output. Every sentence adds value without redundancy, and information is front-loaded for quick comprehension.

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

Completeness5/5

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

Given the tool's simplicity (one parameter, full schema coverage, rich annotations), the description is complete. It explains the purpose, parameters, and return value adequately. No output schema exists, but the description specifies the return format, compensating for that gap. The annotations cover safety, making additional behavioral details less critical.

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%, with the parameter 'id' fully documented in the schema. The description repeats the parameter info in the 'Args' section but adds no additional meaning beyond what the schema provides (e.g., format examples or constraints). This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Export a workflow as JSON') and resource ('workflow'), distinguishing it from siblings like 'n8n_get_workflow' (which likely returns metadata) and 'n8n_import_workflow' (the inverse operation). It explicitly mentions the purpose ('for backup or import elsewhere'), making the intent unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('for backup or import elsewhere'), but does not explicitly state when not to use it or name alternatives. For example, it doesn't contrast with 'n8n_get_workflow' (if that returns different data) or mention prerequisites like needing an existing workflow ID.

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/DrBalls/n8n-mcp-server-v2'

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