Skip to content

feat(opencode): let tools opt into strict mode - #42236

Open
mayshwartz2 wants to merge 2 commits into
anomalyco:devfrom
mayshwartz2:tool-strict-mode-2
Open

feat(opencode): let tools opt into strict mode#42236
mayshwartz2 wants to merge 2 commits into
anomalyco:devfrom
mayshwartz2:tool-strict-mode-2

Conversation

@mayshwartz2

@mayshwartz2 mayshwartz2 commented Aug 13, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #40214

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds strict?: boolean to the tool definition and the tool.definition plugin hook, passed to the AI SDK Tool only when a tool sets it.

Today session/llm/request.ts forces strict: false on 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

[FEATURE]: Let tools opt into strict mode

1 participant