Skip to content

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

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

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.
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Let tools opt into strict mode

1 participant