Skip to content

fix(prompt): support Anthropic anyOf tool schemas - #2261

Open
kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/anthropic-anyof
Open

kyboi wants to merge 1 commit into
JetBrains:developfrom
Kreoh:contribute/anthropic-anyof

Conversation

@kyboi

@kyboi kyboi commented Sep 29, 2026

Copy link
Copy Markdown

Anthropic request construction rejects non-null ToolParameterType.AnyOf parameters before sending a request. Serialise those alternatives as JSON Schema anyOf, preserving nested schemas and non-blank descriptions. Existing nullable-union serialisation remains unchanged.

Regression coverage includes scalar alternatives, a number-or-object parameter, nested unions, blank descriptions and nullable-union compatibility. The three non-null union regressions fail on upstream before the fix.

Validation: all 49 Anthropic JVM tests pass; the JVM JAR build and commonMain and jvmTest ktlint checks pass. Non-JVM targets and live provider calls were not tested. No public API changes.

Adapted from Kroog commit 967531a8c, with additional focused regression coverage.

Fixes #2260.

This branch has not been deployed

No deployments
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.

Anthropic client rejects non-null anyOf tool parameters

1 participant