Skip to main content
Glama

n8n_update_full_workflow

Idempotent

Replace an entire n8n workflow by providing a complete set of nodes and connections. Use this tool to update workflow structure and settings in one operation.

Instructions

Full workflow update. Requires complete nodes[] and connections{}. For incremental use n8n_update_partial_workflow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWorkflow ID to update
nameNoNew workflow name
nodesNoComplete array of workflow nodes (required if modifying workflow structure)
connectionsNoComplete connections object (required if modifying workflow structure)
settingsNoWorkflow settings to update

Implementation Reference

  • The core handler function for the 'n8n_update_full_workflow' tool. Parses input, creates optional backup, validates workflow structure, performs the update via N8nApiClient.updateWorkflow, tracks telemetry, and returns success/error response.
    export async function handleUpdateWorkflow(
      args: unknown,
      repository: NodeRepository,
      context?: InstanceContext
    ): Promise<McpToolResponse> {
      const startTime = Date.now();
      const sessionId = `mutation_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
      let workflowBefore: any = null;
      let userIntent = 'Full workflow update';
    
      try {
        const client = ensureApiConfigured(context);
        const input = updateWorkflowSchema.parse(args);
        const { id, createBackup, intent, ...updateData } = input;
        userIntent = intent || 'Full workflow update';
    
        // If nodes/connections are being updated, validate the structure
        if (updateData.nodes || updateData.connections) {
          // Always fetch current workflow for validation (need all fields like name)
          const current = await client.getWorkflow(id);
          workflowBefore = JSON.parse(JSON.stringify(current));
    
          // Create backup before modifying workflow (default: true)
          if (createBackup !== false) {
            try {
              const versioningService = new WorkflowVersioningService(repository, client);
              const backupResult = await versioningService.createBackup(id, current, {
                trigger: 'full_update'
              });
    
              logger.info('Workflow backup created', {
                workflowId: id,
                versionId: backupResult.versionId,
                versionNumber: backupResult.versionNumber,
                pruned: backupResult.pruned
              });
            } catch (error: any) {
              logger.warn('Failed to create workflow backup', {
                workflowId: id,
                error: error.message
              });
              // Continue with update even if backup fails (non-blocking)
            }
          }
    
          const fullWorkflow = {
            ...current,
            ...updateData
          };
    
          // Validate workflow structure (n8n API expects FULL form: n8n-nodes-base.*)
          const errors = validateWorkflowStructure(fullWorkflow);
          if (errors.length > 0) {
            return {
              success: false,
              error: 'Workflow validation failed',
              details: { errors }
            };
          }
        }
    
        // Update workflow
        const workflow = await client.updateWorkflow(id, updateData);
    
        // Track successful mutation
        if (workflowBefore) {
          trackWorkflowMutationForFullUpdate({
            sessionId,
            toolName: 'n8n_update_full_workflow',
            userIntent,
            operations: [], // Full update doesn't use diff operations
            workflowBefore,
            workflowAfter: workflow,
            mutationSuccess: true,
            durationMs: Date.now() - startTime,
          }).catch(err => {
            logger.warn('Failed to track mutation telemetry:', err);
          });
        }
    
        return {
          success: true,
          data: {
            id: workflow.id,
            name: workflow.name,
            active: workflow.active,
            nodeCount: workflow.nodes?.length || 0
          },
          message: `Workflow "${workflow.name}" updated successfully. Use n8n_get_workflow with mode 'structure' to verify current state.`
        };
      } catch (error) {
        // Track failed mutation
        if (workflowBefore) {
          trackWorkflowMutationForFullUpdate({
            sessionId,
            toolName: 'n8n_update_full_workflow',
            userIntent,
            operations: [],
            workflowBefore,
            workflowAfter: workflowBefore, // No change since it failed
            mutationSuccess: false,
            mutationError: error instanceof Error ? error.message : 'Unknown error',
            durationMs: Date.now() - startTime,
          }).catch(err => {
            logger.warn('Failed to track mutation telemetry for failed operation:', err);
          });
        }
    
        if (error instanceof z.ZodError) {
          return {
            success: false,
            error: 'Invalid input',
            details: { errors: error.errors }
          };
        }
    
        if (error instanceof N8nApiError) {
          return {
            success: false,
            error: getUserFriendlyErrorMessage(error),
            code: error.code,
            details: error.details as Record<string, unknown> | undefined
          };
        }
    
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error occurred'
        };
      }
    }
  • The tool definition including name, description, and inputSchema for registration in the MCP server.
    {
      name: 'n8n_update_full_workflow',
      description: `Full workflow update. Requires complete nodes[] and connections{}. For incremental use n8n_update_partial_workflow.`,
      inputSchema: {
        type: 'object',
        properties: {
          id: { 
            type: 'string', 
            description: 'Workflow ID to update' 
          },
          name: { 
            type: 'string', 
            description: 'New workflow name' 
          },
          nodes: { 
            type: 'array', 
            description: 'Complete array of workflow nodes (required if modifying workflow structure)',
            items: {
              type: 'object',
              additionalProperties: true
            }
          },
          connections: { 
            type: 'object', 
            description: 'Complete connections object (required if modifying workflow structure)' 
          },
          settings: { 
            type: 'object', 
            description: 'Workflow settings to update' 
          }
        },
        required: ['id']
      }
  • Tool documentation providing detailed usage, examples, best practices, and related tools for n8n_update_full_workflow.
    import { ToolDocumentation } from '../types';
    
    export const n8nUpdateFullWorkflowDoc: ToolDocumentation = {
      name: 'n8n_update_full_workflow',
      category: 'workflow_management',
      essentials: {
        description: 'Full workflow update. Requires complete nodes[] and connections{}. For incremental use n8n_update_partial_workflow.',
        keyParameters: ['id', 'nodes', 'connections'],
        example: 'n8n_update_full_workflow({id: "wf_123", nodes: [...], connections: {...}})',
        performance: 'Network-dependent',
        tips: [
          'Include intent parameter in every call - helps to return better responses',
          'Must provide complete workflow',
          'Use update_partial for small changes',
          'Validate before updating'
        ]
      },
      full: {
        description: 'Performs a complete workflow update by replacing the entire workflow definition. Requires providing the complete nodes array and connections object, even for small changes. This is a full replacement operation - any nodes or connections not included will be removed.',
        parameters: {
          id: { type: 'string', required: true, description: 'Workflow ID to update' },
          name: { type: 'string', description: 'New workflow name (optional)' },
          nodes: { type: 'array', description: 'Complete array of workflow nodes (required if modifying structure)' },
          connections: { type: 'object', description: 'Complete connections object (required if modifying structure)' },
          settings: { type: 'object', description: 'Workflow settings to update (timezone, error handling, etc.)' },
          intent: { type: 'string', description: 'Intent of the change - helps to return better response. Include in every tool call. Example: "Migrate workflow to new node versions".' }
        },
        returns: 'Minimal summary (id, name, active, nodeCount) for token efficiency. Use n8n_get_workflow with mode "structure" to verify current state if needed.',
        examples: [
          'n8n_update_full_workflow({id: "abc", intent: "Rename workflow for clarity", name: "New Name"}) - Rename with intent',
          'n8n_update_full_workflow({id: "abc", name: "New Name"}) - Rename only',
          'n8n_update_full_workflow({id: "xyz", intent: "Add error handling nodes", nodes: [...], connections: {...}}) - Full structure update',
          'const wf = n8n_get_workflow({id}); wf.nodes.push(newNode); n8n_update_full_workflow({...wf, intent: "Add data processing node"}); // Add node'
        ],
        useCases: [
          'Major workflow restructuring',
          'Bulk node updates',
          'Workflow imports/cloning',
          'Complete workflow replacement',
          'Settings changes'
        ],
        performance: 'Network-dependent - typically 200-500ms. Larger workflows take longer. Consider update_partial for better performance.',
        bestPractices: [
          'Always include intent parameter - it helps provide better responses',
          'Get workflow first, modify, then update',
          'Validate with validate_workflow before updating',
          'Use update_partial for small changes',
          'Test updates in non-production first'
        ],
        pitfalls: [
          'Requires N8N_API_URL and N8N_API_KEY configured',
          'Must include ALL nodes/connections',
          'Missing nodes will be deleted',
          'Can break active workflows',
          'No partial updates - use update_partial instead'
        ],
        relatedTools: ['n8n_get_workflow', 'n8n_update_partial_workflow', 'validate_workflow', 'n8n_create_workflow']
      }
    };
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it specifies that complete nodes and connections are required for structure modifications. While annotations already indicate this is a mutable (readOnlyHint=false), open-world, idempotent, non-destructive operation, the description provides practical implementation guidance about what 'full update' entails operationally.

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 perfectly concise with only two sentences that each earn their place: the first states the core purpose and requirement, the second provides the critical alternative guidance. No wasted words, perfectly front-loaded with essential information.

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

Completeness4/5

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

For a workflow update tool with comprehensive annotations and schema coverage but no output schema, the description provides excellent contextual completeness. It covers purpose, differentiation from siblings, and implementation requirements. The only minor gap is lack of information about what happens when nodes/connections aren't provided or about response format, but annotations provide safety context.

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?

With 100% schema description coverage, the schema already documents all 5 parameters thoroughly. The description adds minimal parameter semantics beyond the schema - it emphasizes that nodes and connections must be 'complete' when modifying structure, but doesn't provide additional format or content guidance. This meets the baseline expectation when schema coverage is comprehensive.

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 tool's purpose with specific verb ('Full workflow update') and resource ('workflow'), distinguishing it from its sibling n8n_update_partial_workflow by specifying it requires complete nodes[] and connections{}. This provides immediate differentiation from the partial update alternative.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('For incremental use n8n_update_partial_workflow') and provides clear prerequisites ('Requires complete nodes[] and connections{}'). This gives the agent perfect guidance on when to choose this tool versus its sibling alternative.

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/czlonkowski/n8n-mcp'

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