feat(opencode): let tools opt into strict mode - #42236
Open
mayshwartz2 wants to merge 2 commits into
Open
Conversation
Tools can now declare strict: true, and the tool.definition plugin hook can set or override it. The flag is passed through to the AI SDK Tool, which providers that support structured outputs forward to the model. The existing hardcoded strict: false for @ai-sdk/openai, @ai-sdk/azure and @ai-sdk/amazon-bedrock/mantle is unchanged.
mayshwartz2
force-pushed
the
tool-strict-mode-2
branch
from
August 16, 2026 10:21
7dcd8b8 to
efa5195
Compare
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.
Issue for this PR
Closes #40214
Type of change
What does this PR do?
Adds
strict?: booleanto the tool definition and thetool.definitionplugin hook, passed to the AI SDKToolonly when a tool sets it.Today
session/llm/request.tsforcesstrict: falseon the OpenAI Responses-family providers and leaves it unset elsewhere, so a tool has no way to ask for it. That override still runs after this and still wins, so nothing changes unless a tool opts in.Five lines of source, the rest is tests.
How did you verify your code works?
Rebased on current
dev. Typecheck 30/30.bun test test/tool/ test/provider/ test/session/ test/plugin/: 1452 pass, 0 fail. Reverting the source makes the new registry test fail.Screenshots / recordings
Not a UI change.
Checklist