Skip to content

n8n_update_partial_workflow: operations array received as string from Claude Code (VS Code extension) #600

@YerayRodri

Description

@YerayRodri

Bug Description

When calling n8n_update_partial_workflow from Claude Code (VS Code extension), the operations parameter arrives at the MCP server as a string instead of an array, causing Zod validation to fail.

Error Received

{
  "success": false,
  "error": "Invalid input",
  "details": {
    "errors": [
      {
        "code": "invalid_type",
        "expected": "array",
        "received": "string",
        "path": ["operations"],
        "message": "Expected array, received string"
      }
    ]
  }
}

Environment

  • MCP Server version: 2.35.2 (Docker image 2026-02-10)
  • Docker image: ghcr.io/czlonkowski/n8n-mcp:latest
  • Client: Claude Code (VS Code extension)
  • MCP Mode: stdio
  • Platform: macOS Darwin 25.2.0

Steps to Reproduce

Call n8n_update_partial_workflow with any operation array from Claude Code:

{
  "id": "wf_id",
  "intent": "Rename workflow",
  "operations": [{"type": "updateName", "name": "New Name"}]
}

Expected Behavior

The operations parameter is parsed as an array and the operation is applied successfully.

Actual Behavior

The MCP server receives operations as a JSON string instead of a native array and Zod rejects it with invalid_type.

Possible Fix

Add a Zod preprocessor to coerce JSON strings to arrays before validation:

operations: z.preprocess(
  (val) => (typeof val === "string" ? JSON.parse(val) : val),
  z.array(operationSchema)
)

Notes

All other tools with simple string parameters work correctly (n8n_list_workflows, n8n_get_workflow, n8n_autofix_workflow, n8n_health_check). Only tools requiring array parameters are affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions