n8n - ✅(Solved) Fix create_workflow_from_code and update_workflow MCP tools return extra fields in autoAssignedCredentials violating their own declared outputSchema [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#28274Fetched 2026-04-10 03:44:27
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1mentioned ×1subscribed ×1

Error Message

MCP error -32602: Structured content does not match the tool's output schema: 6. The MCP client rejects the response with: MCP error -32602: Structured content does not match the tool's output schema: data/autoAssignedCredentials/N must NOT have additional properties

  • error: all

PR fix notes

PR #28353: fix(core): Declare credentialType on MCP workflow-builder autoAssignedCredentials schema

Description (problem / solution / changelog)

Summary

The create_workflow_from_code and update_workflow MCP tools each declare an outputSchema for autoAssignedCredentials items containing only nodeName and credentialName. But the handlers return a third field, credentialType, that comes from CredentialAssignment in credentials-auto-assign.ts.

MCP publishes that schema to clients with additionalProperties: false (via toJsonSchemaCompat), so strict MCP clients — OpenCode was the one reported in the issue — reject the tool response even though the handler is working correctly.

The existing test at update-workflow.tool.test.ts already asserts credentialType is present in the response, which shows the field was meant to be exposed; the Zod schema simply wasn't updated to match.

This PR:

  • Adds credentialType to the Zod outputSchema in both create-workflow-from-code.tool.ts and update-workflow.tool.ts so the published schema matches the actual handler output.
  • Adds a regression test in each test file that invokes the handler with a non-empty assignment and parses structuredContent through a reconstructed strict version of the declared schema. Both tests fail on master and pass with the fix applied.

How I tested

cd packages/cli
pnpm exec jest src/modules/mcp/__tests__/update-workflow.tool.test.ts \
               src/modules/mcp/__tests__/create-workflow-from-code.tool.test.ts
# → 39 passed (both new tests green)

# Regression check: stash the fix, rerun → both new tests FAIL as expected.
pnpm exec eslint <the 4 files>           # clean
pnpm exec biome check <the 4 files>      # clean

Related Linear tickets, Github issues, and Community forum posts

Fixes #28274

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive.
  • Docs updated or follow-up ticket created. <!-- n/a — internal schema only -->
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

Changed files

  • packages/cli/src/modules/mcp/__tests__/create-workflow-from-code.tool.test.ts (modified, +39/-0)
  • packages/cli/src/modules/mcp/__tests__/update-workflow.tool.test.ts (modified, +31/-0)
  • packages/cli/src/modules/mcp/tools/workflow-builder/create-workflow-from-code.tool.ts (modified, +1/-0)
  • packages/cli/src/modules/mcp/tools/workflow-builder/update-workflow.tool.ts (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

The create_workflow_from_code and update_workflow instance-level MCP tools declare an outputSchema with additionalProperties: false for items in the autoAssignedCredentials array, allowing only nodeName and credentialName fields.

However, when n8n auto-assigns existing credentials to nodes, it returns additional fields beyond those two, violating its own declared schema.

MCP clients that strictly validate structuredContent against the declared outputSchema — such as OpenCode — fail with:

MCP error -32602: Structured content does not match the tool's output schema: data/autoAssignedCredentials/0 must NOT have additional properties data/autoAssignedCredentials/1 must NOT have additional properties data/autoAssignedCredentials/2 must NOT have additional properties data/autoAssignedCredentials/3 must NOT have additional properties

The declared outputSchema from tools/list is:

"autoAssignedCredentials": { "type": "array", "items": { "type": "object", "properties": { "nodeName": { "type": "string" }, "credentialName": { "type": "string" } }, "required": ["nodeName", "credentialName"], "additionalProperties": false } }

The schema declares additionalProperties: false but the actual response contains extra fields beyond nodeName and credentialName when auto-assignment occurs.

To Reproduce

  1. Set up n8n instance-level MCP (Settings > Instance-level MCP)
  2. Connect a strict MCP client that validates structuredContent against outputSchema (e.g. OpenCode)
  3. Ask the client to create or update a workflow using create_workflow_from_code or update_workflow with nodes that have compatible credentials already registered in the n8n instance (e.g. Shopify, Google Sheets, Google Gemini)
  4. n8n auto-assigns the existing credentials to the nodes
  5. The response includes extra fields in the autoAssignedCredentials array items beyond nodeName and credentialName
  6. The MCP client rejects the response with: MCP error -32602: Structured content does not match the tool's output schema: data/autoAssignedCredentials/N must NOT have additional properties

Expected behavior

The autoAssignedCredentials array items in the response should only contain nodeName and credentialName fields, matching the outputSchema declared in tools/list.

Either:

  • Remove additionalProperties: false from the outputSchema to allow extra fields, or
  • Strip any extra fields from autoAssignedCredentials before returning the response

Debug Info

Debug info

core

  • n8nVersion: 2.15.0
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.13.1
  • nodeEnv: production
  • database: postgres
  • executionMode: scaling (single-main)
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: 36653482-5986-475a-a46e-6b2c1ae2d3df

storage

  • success: all
  • error: all
  • progress: true
  • manual: true
  • binaryMode: memory

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/146.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2026-04-09T19:37:14.775Z

Operating System

Linux (Docker) - Debian 13

n8n Version

2.15.0

Node.js Version

v24.13.1

Database

PostgreSQL

Execution mode

queue

Hosting

self hosted

extent analysis

TL;DR

The issue can be resolved by either removing additionalProperties: false from the outputSchema or stripping extra fields from autoAssignedCredentials before returning the response.

Guidance

  • Review the outputSchema declared in tools/list and consider removing additionalProperties: false to allow extra fields in the autoAssignedCredentials array items.
  • Alternatively, modify the response processing to strip any extra fields from autoAssignedCredentials before returning the response to the MCP client.
  • Verify that the MCP client can successfully validate the structured content against the updated outputSchema.
  • Test the changes with different workflow creation and update scenarios to ensure the fix is robust.

Example

// Updated outputSchema with additionalProperties: false removed
"autoAssignedCredentials": {
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "nodeName": { "type": "string" },
      "credentialName": { "type": "string" }
    },
    "required": ["nodeName", "credentialName"]
  }
}

Notes

The fix may require updates to the n8n instance-level MCP tools or the MCP client's validation logic. Ensure that any changes are thoroughly tested to avoid introducing new issues.

Recommendation

Apply a workaround by removing additionalProperties: false from the outputSchema, as this is a more straightforward change that can be implemented quickly to resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The autoAssignedCredentials array items in the response should only contain nodeName and credentialName fields, matching the outputSchema declared in tools/list.

Either:

  • Remove additionalProperties: false from the outputSchema to allow extra fields, or
  • Strip any extra fields from autoAssignedCredentials before returning the response

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING