fix(tools): fix discord tool schema type mismatch for Gemini#13486
Open
dirty-bun-ops wants to merge 1 commit intoNousResearch:mainfrom
Open
fix(tools): fix discord tool schema type mismatch for Gemini#13486dirty-bun-ops wants to merge 1 commit intoNousResearch:mainfrom
dirty-bun-ops wants to merge 1 commit intoNousResearch:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Resolves an issue where the
discord_servertool causes Google Gemini API requests to fail withHTTP 400 INVALID_ARGUMENT.Problem:
The Google Gemini API strictly requires all
enumparameter values in tool function declarations to be strings (or it rejects the schema). Theauto_archive_durationparameter in thediscord_serverschema was using an integer enum ([60, 1440, ...]). Because Gemini validates the entire toolset upon initialization, this single typo would cause the entire tool payload to be rejected, instantly breaking agent sessions and any scheduled Cron jobs that rely on these global toolsets.Solution:
Changed the
auto_archive_durationschema type to"string"and converted its enums to string representations (["60", "1440", ...]). To preserve compatibility with Discord's REST API (which expects an integer payload), a simpleint()cast was added inside the tool's runtime implementation.Related Issue
Type of Change
Changes Made
tools/discord_tool.py:auto_archive_durationparameter schema type to"string".["60", "1440", "4320", "10080"].int()cast toauto_archive_durationwhen constructing the JSON body in_create_thread.How to Test
google/gemma-4-31bvia AI Studio).discord_server).400 Bad Requestregarding schema validation.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Tested on production with
google/gemma-4-31bwhere all previously failing Cron jobs utilizing the same toolset were successfully restored.