Skip to content

fix: use z.array(z.unknown()) to fix VS Code MCP schema validation error#27

Merged
makafeli merged 2 commits intomakafeli:mainfrom
nhbduy:fix/vscode-array-schema-items
Mar 19, 2026
Merged

fix: use z.array(z.unknown()) to fix VS Code MCP schema validation error#27
makafeli merged 2 commits intomakafeli:mainfrom
nhbduy:fix/vscode-array-schema-items

Conversation

@nhbduy
Copy link
Copy Markdown
Contributor

@nhbduy nhbduy commented Mar 19, 2026

Problem

When using this MCP server with GitHub Copilot in VS Code (≥1.99), all tools that accept workflow objects fail to load with the error:

tool parameters array type must have items

VS Code validates MCP tool parameter schemas against the JSON Schema spec, which requires array types to include an items field. The current code uses z.array(z.any()), which compiles to {"type": "array"} — missing items.

Fix

Change z.array(z.any())z.array(z.unknown()) for nodes and tags parameters. z.unknown() compiles to {} as the items schema, producing valid JSON Schema: {"type": "array", "items": {}}.

Affected tools

  • create_workflow
  • update_workflow
  • create_workflow_and_activate

Impact

  • No runtime behaviour changez.unknown() accepts any value at runtime, same as z.any()
  • Fixes VS Code MCP tool loading for all array-typed workflow parameters
  • All other array parameters (tagIds, categories) already use typed schemas and are unaffected

Tested

Verified with VS Code 1.111.0 + GitHub Copilot extension in Agent mode. After this fix, all 23 tools appear correctly and workflow CRUD operations work end-to-end.

…dation

- VS Code >=1.99 validates MCP tool parameter schemas against JSON Schema spec. z.array(z.any()) produces {\"type\":\"array\"} without an 'items' field, which VS Code rejects with: 'tool parameters array type must have items'.

- Replacing with z.array(z.unknown()) produces {\"type\":\"array\",\"items\":{}} which satisfies VS Code's validator while keeping the same runtime behaviour.

- Affects: nodes and tags fields in create_workflow, update_workflow, and create_workflow_and_activate tool definitions.
@makafeli makafeli merged commit 411c0a7 into makafeli:main Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants