pub enum Tool {
Function {
function_declarations: Vec<FunctionDeclaration>,
},
GoogleSearch {
google_search: GoogleSearchConfig,
},
GoogleMaps {
google_maps: Value,
},
CodeExecution {
code_execution: Value,
},
URLContext {
url_context: URLContextConfig,
},
FileSearch {
file_search: Value,
},
ComputerUse {
computer_use: Value,
},
McpServer {
mcp_server: Value,
},
}Expand description
Tool that can be used by the model
Variants§
Function
Function-based tool
Fields
function_declarations: Vec<FunctionDeclaration>The function declaration for the tool
GoogleSearch
Google Search tool
Fields
google_search: GoogleSearchConfigThe Google Search configuration
GoogleMaps
Google Maps tool
CodeExecution
Code execution tool
URLContext
Fields
url_context: URLContextConfigFileSearch
File search tool
ComputerUse
Computer use tool
McpServer
MCP server tool
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn new(function_declaration: FunctionDeclaration) -> Self
pub fn new(function_declaration: FunctionDeclaration) -> Self
Create a new tool with a single function declaration
Sourcepub fn with_functions(function_declarations: Vec<FunctionDeclaration>) -> Self
pub fn with_functions(function_declarations: Vec<FunctionDeclaration>) -> Self
Create a new tool with multiple function declarations
Sourcepub fn google_search() -> Self
pub fn google_search() -> Self
Create a new Google Search tool
Sourcepub fn url_context() -> Self
pub fn url_context() -> Self
Create a new URL Context tool
Sourcepub fn google_maps(config: Value) -> Self
pub fn google_maps(config: Value) -> Self
Create a new Google Maps tool
Sourcepub fn code_execution() -> Self
pub fn code_execution() -> Self
Create a new code execution tool
Sourcepub fn file_search(config: Value) -> Self
pub fn file_search(config: Value) -> Self
Create a new file search tool
Sourcepub fn computer_use(config: Value) -> Self
pub fn computer_use(config: Value) -> Self
Create a new computer use tool
Sourcepub fn mcp_server(config: Value) -> Self
pub fn mcp_server(config: Value) -> Self
Create a new MCP server tool
Sourcepub fn is_server_side(&self) -> bool
pub fn is_server_side(&self) -> bool
Returns true if this tool is a server-side built-in tool (e.g., Google Search,
URL Context, Google Maps, Code Execution) that Gemini 3 executes internally.
When server-side tools are present, includeServerSideToolInvocations should be
set in the ToolConfig so Gemini 3 returns toolCall/toolResponse parts instead
of silently truncating the response.