Binds tools with automatic schema transformation.
This overridden method specifically handles tool binding after automatically transforming all tools for Gemini compatibility.
Array of tools to bind (MCP tools, StructuredTools, etc.)
Optionalkwargs: Partial<GoogleGenerativeAIChatCallOptions>Additional configuration options
New ChatGoogleGenerativeAIEx instance with transformed tools
Drop-in replacement for ChatGoogleGenerativeAI that automatically transforms MCP tool schemas to be compatible with Gemini's strict schema requirements.
Simply replace your ChatGoogleGenerativeAI import with ChatGoogleGenerativeAIEx and all MCP tool schemas will be automatically transformed for Gemini compatibility.
Usage:
Verbose Logging:
Set environment variable to see transformation details:
This will show:
What Gets Fixed:
Key Benefits:
Known Limitations:
$refdefinitions that aren't available, they're simplified to a generic object.oneOf/allOfare simplified, which may loosen or slightly change validation rules.These adjustments keep most MCP tools working, but rare edge cases could behave differently from the original schema.