Skip to content

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

Open
RheagalFire wants to merge 1 commit intoanomalyco:devfrom
RheagalFire:fix/tool-schema-required-field
Open

fix(opencode): make bash tool description parameter optional#26420
RheagalFire wants to merge 1 commit intoanomalyco: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
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

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

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

1 participant