Skip to content

fix: make JSON Schema to Zod conversion recursive for array/object types#6

Open
etnt wants to merge 1 commit intoWebexSamples:mainfrom
etnt:fix-for-working-with-vscode
Open

fix: make JSON Schema to Zod conversion recursive for array/object types#6
etnt wants to merge 1 commit intoWebexSamples:mainfrom
etnt:fix-for-working-with-vscode

Conversation

@etnt
Copy link
Copy Markdown

@etnt etnt commented Apr 28, 2026

The VS Code MCP client requires array types to include an items schema in JSON Schema. The previous flat conversion discarded items on arrays and properties on objects, producing invalid schemas like { type: "array" } without items. This caused VS Code to reject all tools with array parameters:

"tool parameters array type must have items"

Extract a recursive jsonSchemaTypeToZod() helper that preserves nested items and properties when converting to Zod, so the MCP SDK serializes complete JSON Schema back to the client.

The VS Code MCP client requires array types to include an `items` schema
in JSON Schema. The previous flat conversion discarded `items` on arrays
and `properties` on objects, producing invalid schemas like `{ type: "array" }`
without items. This caused VS Code to reject all tools with array parameters:

  "tool parameters array type must have items"

Extract a recursive `jsonSchemaTypeToZod()` helper that preserves nested
`items` and `properties` when converting to Zod, so the MCP SDK serializes
complete JSON Schema back to the client.
Copilot AI review requested due to automatic review settings April 28, 2026 14:50
@etnt etnt requested a review from kkambhat as a code owner April 28, 2026 14:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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