GoogleSearchTool

class GoogleSearchTool(val bypassMultiToolsLimit: Boolean = false, val model: String? = null) : BaseTool

A built-in tool that is automatically invoked by Gemini 2 and 3 models to retrieve search results from Google Search.

This tool operates internally within the model and does not require or perform local code execution.

Constructors

Link copied to clipboard
constructor(bypassMultiToolsLimit: Boolean = false, model: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard

The custom metadata of the tool.

Link copied to clipboard

The description of the tool.

Link copied to clipboard
val isLongRunning: Boolean = false

Whether the tool's final result will be delivered out-of-band. When true, the framework marks the call as long-running and uses the tool's return value as the function-response payload. Returning Unit means "no response yet": the FR event is suppressed so the function-call event (which carries the call id in longRunningToolIds and is thus the turn's final response) ends the turn without re-invoking the model. A non-Unit return -- including an explicit empty Map -- is treated as a real response and emitted. (Unit suppression aligns with Python; Java instead always emits {}.) The longRunningToolIds id also drives the resumable-mode pause gate so the invocation can be resumed later via a user-injected function-response.

Link copied to clipboard
val model: String? = null
Link copied to clipboard

The name of the tool.

Functions

Link copied to clipboard
open fun close()
Link copied to clipboard
open override fun declaration(): FunctionDeclaration?

Returns the underlying function declaration.

Link copied to clipboard
open suspend override fun processLlmRequest(toolContext: ToolContext, llmRequest: LlmRequest): LlmRequest

Processes the LLM request before it is sent.

Link copied to clipboard
open suspend override fun run(context: ToolContext, args: Map<String, Any>): Any

Executes the tool and returns its result.