Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

n8n_duplicate_workflow

Create a copy of an existing n8n workflow by specifying its ID, with an optional new name for the duplicate.

Instructions

Create a copy of an existing workflow.

Args:

  • id (string): Workflow ID to duplicate

  • newName (string, optional): Name for the copy (default: "Copy of [original name]")

Returns: The duplicated workflow with its new ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWorkflow ID to duplicate
newNameNoName for the copy

Implementation Reference

  • The handler function for 'n8n_duplicate_workflow', which retrieves an existing workflow, prepares it for duplication (clearing ID/metadata), updates the name, sets it to inactive, and creates it as a new workflow via a POST request.
      server.registerTool(
        'n8n_duplicate_workflow',
        {
          title: 'Duplicate Workflow',
          description: `Create a copy of an existing workflow.
    
    Args:
      - id (string): Workflow ID to duplicate
      - newName (string, optional): Name for the copy (default: "Copy of [original name]")
    
    Returns:
      The duplicated workflow with its new ID.`,
          inputSchema: z.object({
            id: z.string().min(1).describe('Workflow ID to duplicate'),
            newName: z.string().optional().describe('Name for the copy')
          }).strict(),
          annotations: {
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: false
          }
        },
        async (params: { id: string; newName?: string }) => {
          // Get the original workflow
          const original = await get<Record<string, unknown>>(`/workflows/${params.id}`);
          
          // Prepare copy
          const copy = { ...original };
          delete copy.id;
          delete copy.createdAt;
          delete copy.updatedAt;
          delete copy.versionId;
          copy.name = params.newName || `Copy of ${original.name}`;
          copy.active = false; // Always deactivate copies
          
          // Create the copy
          const newWorkflow = await post<Record<string, unknown>>('/workflows', copy);
          
          return {
            content: [{ type: 'text', text: `✅ Workflow duplicated!\n\n- Original ID: ${params.id}\n- New ID: ${newWorkflow.id}\n- New Name: ${newWorkflow.name}` }],
            structuredContent: newWorkflow
          };
        }
      );

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