feat(ai-core): support JSON Schema union types in ToolRequestParameterProperty#17576
Open
kaikongbj wants to merge 2 commits into
Open
feat(ai-core): support JSON Schema union types in ToolRequestParameterProperty#17576kaikongbj wants to merge 2 commits into
kaikongbj wants to merge 2 commits into
Conversation
…port type support
…rProperty This change adds support for JSON Schema union types where the 'type' field can be an array of strings (e.g., type: ['string', 'null']) instead of just a single string. Changes: - Updated ToolRequestParameterProperty interface to accept string | string[] - Enhanced isToolRequestParameterProperty validator to check array types Fixes eclipse-theia#16615 - complements PR eclipse-theia#16780 which fixed SDK/zod layer This enables MCP tools with union type schemas to work correctly in Theia.
Member
|
Thanks for the contribution!
Also, the current description only covers the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for JSON Schema union types in the
ToolRequestParameterPropertyinterface and its type guard functionisToolRequestParameterProperty. This enables MCP tools with union type schemas (e.g.,type: ["string", "null"]) to work correctly in Theia.Problem
When MCP tools include JSON Schema with union types (where
typeis an array like["string", "null"]), Theia'sisToolRequestParameterPropertyvalidation function rejects these schemas, causing tool properties to be dropped.Solution
Interface Update: Changed
ToolRequestParameterProperty.typefromstringtostring | string[]to accept both single types and union types (arrays).Validator Enhancement: Updated
isToolRequestParameterPropertyto validate:typeas a string (existing behavior, backward compatible)typeas an array of strings (new union type support)Related
This PR complements the SDK/zod layer fix by adding type-level support in
language-model.ts.Backward Compatibility
This change is fully backward compatible:
typevalues continue to work as beforeanyOfsupportTesting
The change enables MCP tools that declare union type schemas to be validated and used correctly, without dropping properties whose
typeis an array of strings.Signed-off-by: kaikongbj kaikongbj@github.com