Fix: Make tool schemas compatible with Gemini models#3
Open
zzgael wants to merge 5 commits intoAugmented-Nature:mainfrom
Open
Fix: Make tool schemas compatible with Gemini models#3zzgael wants to merge 5 commits intoAugmented-Nature:mainfrom
zzgael wants to merge 5 commits intoAugmented-Nature:mainfrom
Conversation
…ss_environmental_fate, get_regulatory_info with comprehensive analysis
- Incorporated all new tools and features from lighteternal/PubChem-MCP-Server - Fixed Gemini/VertexAI compatibility by removing union types in tool schemas - Changed all 'cid' parameters from type: ['number', 'string'] to type: 'string' - Maintains full backward compatibility (JavaScript coerces numbers to strings) This combines: 1. lighteternal's extensive new tools for toxicity, regulatory info, and more 2. Gemini compatibility fix for all tool schemas Fixes: zod_to_gemini_parameters: Gemini cannot handle union types
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.
Problem
Gemini/VertexAI models cannot process tool schemas that contain union types. This causes the error:
This issue affects all MCP clients when using Gemini models, not just specific implementations.
Fixes #1 - This addresses the same root cause: union types in tool schemas are incompatible with Gemini's parameter processing.
Solution
Changed all
cidparameters from union type['number', 'string']to single type'string'.Changes Made
src/index.tscid: { type: ['number', 'string'], description: 'PubChem Compound ID (CID)' }cid: { type: 'string', description: 'PubChem Compound ID (CID) - accepts numeric or string values' }Why This Works
Additional Improvements
This PR also incorporates the excellent work from @lighteternal's fork, including:
Testing
2244) and string (e.g.,"2244") CIDsRelated Issues
cc: @lighteternal - incorporated your improvements as well!