Repository navigation
fix(agents): parse disjoint oneOf MCP parameter schemas - #2288
Open
Thilo Schmalfuß (scthi) wants to merge 1 commit into
Open
Thilo Schmalfuß (scthi) wants to merge 1 commit into
Thilo Schmalfuß (scthi) wants to merge 1 commit into
Conversation
Handle untyped object-or-string parameters at the MCP descriptor parser seam. Represent oneOf with the existing AnyOf only when alternatives have disjoint JSON types; reject overlap and unsupported sibling constraints explicitly. Preserve anyOf behavior and propagate recursion depth through unions. Add generic JVM/JS regression coverage and document the descriptor's limitations. Parser tests (39 on each target) and MCP ktlintCheck pass. Module and full builds are blocked by the missing Android SDK. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Thilo Schmalfuß (scthi)
marked this pull request as ready for review
October 2, 2026 05:27
This branch has not been deployed
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.
Handle untyped
oneOfMCP tool parameters directly inDefaultMcpToolDescriptorParser.A generic parameter such as
{"oneOf":[{"type":"object"},{"type":"string"}]}previously failed withIllegalArgumentException: Parameter ... must have type property. This prevents describing tools that accept either a JSON object or a JSON-encoded string.Reuse
ToolParameterType.AnyOfonly for alternatives whose JSON type sets are provably disjoint, where at-least-one and exactly-one are equivalent. Reject overlapping alternatives (including integer/number and overlapping null branches), unsupported sibling constraints, and unrepresentable multi-type arrays rather than silently weakening or truncating them. Preserve existinganyOfoverlap behavior and propagate recursion depth through union branches. Document that the descriptor is not a full JSON Schema validator.Related to #2017 and overlapping open PR #2067. Unlike #2067's unconditional mapping, this deliberately supports only disjoint alternatives and does not add
constsupport.Validation:
oneOfdispatch is removed; it passes when restored../gradlew :agents:agents-mcp:jvmTest --tests 'ai.koog.agents.mcp.*ToolDescriptorParserTest' :agents:agents-mcp:ktlintCheck— passed; 39 JVM parser tests (11 new, 28 existing), no failures or skips../gradlew :agents:agents-mcp:jsTest— passed; 39 JS parser tests, no failures or skips../gradlew :agents:agents-mcp:buildand./gradlew build— blocked before execution by the missing local Android SDK. No claim of a successful full build.All fixtures are freshly authored and generic. No timeout behavior changes or new public descriptor variants.