Skip to content

fix(ai): strip non-standard 'optional' keyword from tool JSON schema parameters - #647

Open
Indosaram wants to merge 1 commit into
code-yeongyu:mainfrom
Indosaram:main
Open

fix(ai): strip non-standard 'optional' keyword from tool JSON schema parameters#647
Indosaram wants to merge 1 commit into
code-yeongyu:mainfrom
Indosaram:main

Conversation

@Indosaram

@Indosaram Indosaram commented Aug 2, 2026

Copy link
Copy Markdown

Fixes 400 Bad Request error on Gemini API and proxies (e.g. Quotio) caused by non- standard 'optional' fields inside tool parameter JSON schemas.


Summary by cubic

Strips the non-standard 'optional' keyword from tool parameter JSON schemas to prevent 400 Bad Request errors on Gemini and proxies like Quotio. Applies to normalized schemas and Gemini parametersJsonSchema.

  • Bug Fixes
    • Recursively remove optional from parametersJsonSchema when useParameters=false in convertTools.
    • Ignore optional during validation and drop it in schema normalization.

Written for commit ddb2531. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/ai/src/api/google-shared.ts
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.

1 participant