Skip to content

fix(converters): resolve top-level oneOf/allOf/anyOf in tool schemas - #232

Open
xy69 wants to merge 1 commit into
jwadow:mainfrom
xy69:fix/top-level-composition-schema
Open

fix(converters): resolve top-level oneOf/allOf/anyOf in tool schemas#232
xy69 wants to merge 1 commit into
jwadow:mainfrom
xy69:fix/top-level-composition-schema

Conversation

@xy69

@xy69 xy69 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

Fixes Bedrock TOOL_SCHEMA_INVALID error when tools have oneOf, allOf, or anyOf at the top level of their input_schema.

Problem

OpenCode (and potentially other clients) send tools whose input schemas use JSON Schema composition keywords at the root level. Bedrock rejects these with:

tools.67.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level (reason: TOOL_SCHEMA_INVALID)

Solution

Added _resolve_top_level_composition() that flattens these before sending to Kiro:

  • anyOf/oneOf: picks the first object-type variant (or first if none is object)
  • allOf: merges all variants into a single schema

Nested composition keywords are preserved — Bedrock only rejects them at the root.

Testing

  • 8 new tests covering all resolution strategies and edge cases
  • All 17 TestSanitizeJsonSchema tests pass
  • Full suite: 1679 passed, no regressions

Bedrock rejects tool input_schema containing oneOf, allOf, or anyOf at
the top level (TOOL_SCHEMA_INVALID). This resolves them before sending:
- anyOf/oneOf: picks the first object-type variant
- allOf: merges all variants into a single schema

Nested composition keywords are preserved since Bedrock only rejects
them at the root of input_schema.
@cla-bot

cla-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

Thanks for the PR! 🎉

Before merge, we need a one-time CLA confirmation.
It confirms that you have the right to contribute this code and allow the project to use it.

Full CLA text:
https://github.com/jwadow/kiro-gateway/blob/main/CLA.md

Please reply once with:

I have read the CLA and I accept its terms

You need to write once, all further messages from me can be ignored.

@xy69

xy69 commented Jun 23, 2026

Copy link
Copy Markdown
Author

I have read the CLA and I accept its terms

@ankitcharolia

Copy link
Copy Markdown

@xy69 could you give a try to this gateway: https://github.com/ankitcharolia/kiro-gateway

It works quite well with All AI harness and actively being developed. The most important thing is that it is ACP compliant

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