Describe the bug
When using built-in tools (e.g. GoogleSearch, URLContext) alongside custom function calling tools, the Gemini API returns:
Error 400, Message: Please enable tool_config.include_server_side_tool_invocations to use Built-in tools with Function calling., Status: INVALID_ARGUMENT
The GenerateContentConfig.ToolConfig needs IncludeServerSideToolInvocations set to true when both built-in tools and function declarations are present.
To Reproduce
- Create a ChatModel with
EnableGoogleSearch configured
- Pass function calling tools via
schema.ToolInfo
- Call
Generate or Stream
- API returns
INVALID_ARGUMENT
Expected behavior
The adapter should automatically set ToolConfig.IncludeServerSideToolInvocations = true when any built-in tool (GoogleSearch, URLContext, CodeExecution, ComputerUse, FileSearch, GoogleSearchRetrieval, GoogleMaps) is enabled alongside function declarations.
Version:
gemini@v0.1.29
Environment:
google.golang.org/genai v1.51.0+ (field added in this version)
Additional context
The IncludeServerSideToolInvocations field was added to genai.ToolConfig in google.golang.org/genai v1.51.0. The current go.mod pins v1.36.0 which predates this field, so the fix also requires bumping the genai dependency.
Describe the bug
When using built-in tools (e.g.
GoogleSearch,URLContext) alongside custom function calling tools, the Gemini API returns:The
GenerateContentConfig.ToolConfigneedsIncludeServerSideToolInvocationsset totruewhen both built-in tools and function declarations are present.To Reproduce
EnableGoogleSearchconfiguredschema.ToolInfoGenerateorStreamINVALID_ARGUMENTExpected behavior
The adapter should automatically set
ToolConfig.IncludeServerSideToolInvocations = truewhen any built-in tool (GoogleSearch, URLContext, CodeExecution, ComputerUse, FileSearch, GoogleSearchRetrieval, GoogleMaps) is enabled alongside function declarations.Version:
gemini@v0.1.29
Environment:
google.golang.org/genai v1.51.0+ (field added in this version)
Additional context
The
IncludeServerSideToolInvocationsfield was added togenai.ToolConfigingoogle.golang.org/genaiv1.51.0. The currentgo.modpinsv1.36.0which predates this field, so the fix also requires bumping the genai dependency.