Skip to content

fix(schema): stringify non-string enum values in Google tool format#610

Closed
mhsdef wants to merge 1 commit intoagentjido:mainfrom
mhsdef:fix/schema-stringify-google-enums
Closed

fix(schema): stringify non-string enum values in Google tool format#610
mhsdef wants to merge 1 commit intoagentjido:mainfrom
mhsdef:fix/schema-stringify-google-enums

Conversation

@mhsdef
Copy link
Copy Markdown
Contributor

@mhsdef mhsdef commented Apr 14, 2026

Description

Google's Gemini API requires all enum values in tool parameter schemas to be strings. When a schema contains integer or atom enum values (e.g., [1, 2, 3]), the API rejects the request. This adds a stringify_enums/1 pass to to_google_format/1 that coerces all enum values to strings before wire encoding.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Breaking Changes

N/A

Testing

  • Tests pass (mix test)
  • Quality checks pass (mix quality)

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation accordingly
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • My commits follow conventional commit format
  • I have NOT edited CHANGELOG.md (it is auto-generated by git_ops)

Related Issues

N/A

Google's Gemini API requires enum values to be strings. When a tool
parameter schema contains integer or atom enum values, the API rejects
the request. This adds a stringify_enums pass to to_google_format/1
that coerces all enum values to strings before sending.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mhsdef mhsdef closed this Apr 14, 2026
@mhsdef
Copy link
Copy Markdown
Contributor Author

mhsdef commented Apr 14, 2026

Hmm, this NimbleOption vs JSON Schema, across providers........is...somethin'.

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