Tool

@Serializable
data class Tool(val retrieval: Retrieval? = null, val computerUse: ComputerUse? = null, val fileSearch: FileSearch? = null, val googleSearch: GoogleSearch? = null, val googleMaps: GoogleMaps? = null, val codeExecution: ToolCodeExecution? = null, val enterpriseWebSearch: EnterpriseWebSearch? = null, val functionDeclarations: List<FunctionDeclaration>? = null, val googleSearchRetrieval: GoogleSearchRetrieval? = null, val parallelAiSearch: ToolParallelAiSearch? = null, val urlContext: UrlContext? = null, val mcpServers: List<McpServer>? = null, val exaAiSearch: ToolExaAiSearch? = null)

Tool details of a tool that the model may use to generate a response.

Constructors

Link copied to clipboard
constructor(retrieval: Retrieval? = null, computerUse: ComputerUse? = null, fileSearch: FileSearch? = null, googleSearch: GoogleSearch? = null, googleMaps: GoogleMaps? = null, codeExecution: ToolCodeExecution? = null, enterpriseWebSearch: EnterpriseWebSearch? = null, functionDeclarations: List<FunctionDeclaration>? = null, googleSearchRetrieval: GoogleSearchRetrieval? = null, parallelAiSearch: ToolParallelAiSearch? = null, urlContext: UrlContext? = null, mcpServers: List<McpServer>? = null, exaAiSearch: ToolExaAiSearch? = null)

Properties

Link copied to clipboard

Optional. CodeExecution tool type. Enables the model to execute code as part of generation.

Link copied to clipboard

Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.

Link copied to clipboard

Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.

Link copied to clipboard

Optional. Uses Exa.ai to search for information to answer user queries. The search results will be grounded on Exa.ai and presented to the model for response generation. This field is not supported in Gemini API.

Link copied to clipboard
val fileSearch: FileSearch? = null

Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. This field is not supported in Vertex AI.

Link copied to clipboard

Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 512 function declarations can be provided.

Link copied to clipboard
val googleMaps: GoogleMaps? = null

Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.

Link copied to clipboard

Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.

Link copied to clipboard

Optional. Specialized retrieval tool that is powered by Google Search.

Link copied to clipboard
val mcpServers: List<McpServer>? = null

Optional. MCP Servers to connect to. This field is not supported in Vertex AI.

Link copied to clipboard

Optional. If specified, Vertex AI will use Parallel.ai to search for information to answer user queries. The search results will be grounded on Parallel.ai and presented to the model for response generation. This field is not supported in Gemini API.

Link copied to clipboard
val retrieval: Retrieval? = null

Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. This field is not supported in Gemini API.

Link copied to clipboard
val urlContext: UrlContext? = null

Optional. Tool to support URL context retrieval.