Skip to content

fix(opencode): make bash tool description parameter optional#26420

Closed
RheagalFire wants to merge 1 commit into
anomalyco:devfrom
RheagalFire:fix/tool-schema-required-field
Closed

fix(opencode): make bash tool description parameter optional#26420
RheagalFire wants to merge 1 commit into
anomalyco:devfrom
RheagalFire:fix/tool-schema-required-field

Conversation

@RheagalFire

Copy link
Copy Markdown

Issue for this PR

Closes #13618

Type of change

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

What does this PR do?

Claude and other providers reject tool schemas that have properties but no required field with: JSON schema is invalid. It must match JSON Schema draft 2020-12.

Plugin tools like session_list generate schemas with properties but no required. The existing code only handles this for Google/Gemini (filtering required in the Gemini sanitizer). Other providers get
the raw schema and reject it.

The fix adds a recursive ensureRequired pass in transform.ts that sets required: [] on any object schema missing it. Runs before any provider-specific sanitizers so all providers benefit.

How did you verify your code works?

  • bun turbo typecheck passes (12/12 packages)
  • Husky pre-push hook passes

Checklist

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

@RheagalFire RheagalFire force-pushed the fix/tool-schema-required-field branch from f7c4781 to 36b4845 Compare May 8, 2026 23:08
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a potentially related PR:

PR #13823: fix: sanitize tool schemas for strict JSON Schema validators (#13737)

This PR appears to be directly related to the current PR (#26420). Both address the issue of invalid tool schemas that fail strict JSON Schema validators. PR #13823 handles schema sanitization for validators that reject schemas with properties but no required field, which is the same core issue being fixed in the current PR.

@RheagalFire RheagalFire changed the title fix: add required field to tool schemas when properties exist fix(opencode): make bash tool description parameter optional May 8, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

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.

Claude API rejects tool schemas: missing 'required' field causes 'JSON schema is invalid' error

1 participant