Class Tool.Builder
- Enclosing class:
- Tool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Toolbuild()Clears the value of codeExecution field.Clears the value of computerUse field.Clears the value of enterpriseWebSearch field.Clears the value of fileSearch field.Clears the value of functionDeclarations field.Clears the value of functions field.Clears the value of googleMaps field.Clears the value of googleSearch field.Clears the value of googleSearchRetrieval field.Clears the value of mcpServers field.Clears the value of parallelAiSearch field.Clears the value of retrieval field.Clears the value of urlContext field.abstract Tool.BuildercodeExecution(ToolCodeExecution codeExecution) Setter for codeExecution.codeExecution(ToolCodeExecution.Builder codeExecutionBuilder) Setter for codeExecution builder.abstract Tool.BuildercomputerUse(ComputerUse computerUse) Setter for computerUse.computerUse(ComputerUse.Builder computerUseBuilder) Setter for computerUse builder.abstract Tool.BuilderenterpriseWebSearch(EnterpriseWebSearch enterpriseWebSearch) Setter for enterpriseWebSearch.enterpriseWebSearch(EnterpriseWebSearch.Builder enterpriseWebSearchBuilder) Setter for enterpriseWebSearch builder.abstract Tool.BuilderfileSearch(FileSearch fileSearch) Setter for fileSearch.fileSearch(FileSearch.Builder fileSearchBuilder) Setter for fileSearch builder.functionDeclarations(FunctionDeclaration... functionDeclarations) Setter for functionDeclarations.functionDeclarations(FunctionDeclaration.Builder... functionDeclarationsBuilders) Setter for functionDeclarations builder.abstract Tool.BuilderfunctionDeclarations(List<FunctionDeclaration> functionDeclarations) Setter for functionDeclarations.Setter for functions.abstract Tool.BuilderSetter for functions.abstract Tool.BuildergoogleMaps(GoogleMaps googleMaps) Setter for googleMaps.googleMaps(GoogleMaps.Builder googleMapsBuilder) Setter for googleMaps builder.abstract Tool.BuildergoogleSearch(GoogleSearch googleSearch) Setter for googleSearch.googleSearch(GoogleSearch.Builder googleSearchBuilder) Setter for googleSearch builder.abstract Tool.BuildergoogleSearchRetrieval(GoogleSearchRetrieval googleSearchRetrieval) Setter for googleSearchRetrieval.googleSearchRetrieval(GoogleSearchRetrieval.Builder googleSearchRetrievalBuilder) Setter for googleSearchRetrieval builder.mcpServers(McpServer... mcpServers) Setter for mcpServers.mcpServers(McpServer.Builder... mcpServersBuilders) Setter for mcpServers builder.abstract Tool.BuildermcpServers(List<McpServer> mcpServers) Setter for mcpServers.abstract Tool.BuilderparallelAiSearch(ToolParallelAiSearch parallelAiSearch) Setter for parallelAiSearch.parallelAiSearch(ToolParallelAiSearch.Builder parallelAiSearchBuilder) Setter for parallelAiSearch builder.abstract Tool.BuilderSetter for retrieval.retrieval(Retrieval.Builder retrievalBuilder) Setter for retrieval builder.abstract Tool.BuilderurlContext(UrlContext urlContext) Setter for urlContext.urlContext(UrlContext.Builder urlContextBuilder) Setter for urlContext builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
retrieval
Setter for retrieval.retrieval: 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.
-
retrieval
Setter for retrieval builder.retrieval: 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.
-
clearRetrieval
Clears the value of retrieval field. -
functions
Setter for functions.functions: The java.lang.reflect.Method instance. If provided, it will to be parsed into a list of FunctionDeclaration instances, and be assigned to the functionDeclarations field.
-
functions
Setter for functions.functions: The java.lang.reflect.Method instance. If provided, it will to be parsed into a list of FunctionDeclaration instances, and be assigned to the functionDeclarations field.
-
clearFunctions
Clears the value of functions field. -
computerUse
Setter for computerUse.computerUse: Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
-
computerUse
Setter for computerUse builder.computerUse: Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
-
clearComputerUse
Clears the value of computerUse field. -
fileSearch
Setter for fileSearch.fileSearch: Optional. Tool to retrieve knowledge from the File Search Stores.
-
fileSearch
Setter for fileSearch builder.fileSearch: Optional. Tool to retrieve knowledge from the File Search Stores.
-
clearFileSearch
Clears the value of fileSearch field. -
googleSearch
Setter for googleSearch.googleSearch: Enables the model to execute Google Search as part of generation.
-
googleSearch
Setter for googleSearch builder.googleSearch: Enables the model to execute Google Search as part of generation.
-
clearGoogleSearch
Clears the value of googleSearch field. -
googleMaps
Setter for googleMaps.googleMaps: Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
-
googleMaps
Setter for googleMaps builder.googleMaps: Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
-
clearGoogleMaps
Clears the value of googleMaps field. -
codeExecution
Setter for codeExecution.codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as part of generation.
-
codeExecution
@CanIgnoreReturnValue public Tool.Builder codeExecution(ToolCodeExecution.Builder codeExecutionBuilder) Setter for codeExecution builder.codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as part of generation.
-
clearCodeExecution
Clears the value of codeExecution field. -
enterpriseWebSearch
Setter for enterpriseWebSearch.enterpriseWebSearch: Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.
-
enterpriseWebSearch
@CanIgnoreReturnValue public Tool.Builder enterpriseWebSearch(EnterpriseWebSearch.Builder enterpriseWebSearchBuilder) Setter for enterpriseWebSearch builder.enterpriseWebSearch: Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.
-
clearEnterpriseWebSearch
Clears the value of enterpriseWebSearch field. -
functionDeclarations
Setter for functionDeclarations.functionDeclarations: 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.
-
functionDeclarations
@CanIgnoreReturnValue public Tool.Builder functionDeclarations(FunctionDeclaration... functionDeclarations) Setter for functionDeclarations.functionDeclarations: 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.
-
functionDeclarations
@CanIgnoreReturnValue public Tool.Builder functionDeclarations(FunctionDeclaration.Builder... functionDeclarationsBuilders) Setter for functionDeclarations builder.functionDeclarations: 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.
-
clearFunctionDeclarations
Clears the value of functionDeclarations field. -
googleSearchRetrieval
Setter for googleSearchRetrieval.googleSearchRetrieval: Optional. Specialized retrieval tool that is powered by Google Search.
-
googleSearchRetrieval
@CanIgnoreReturnValue public Tool.Builder googleSearchRetrieval(GoogleSearchRetrieval.Builder googleSearchRetrievalBuilder) Setter for googleSearchRetrieval builder.googleSearchRetrieval: Optional. Specialized retrieval tool that is powered by Google Search.
-
clearGoogleSearchRetrieval
Clears the value of googleSearchRetrieval field. -
parallelAiSearch
Setter for parallelAiSearch.parallelAiSearch: 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.
-
parallelAiSearch
@CanIgnoreReturnValue public Tool.Builder parallelAiSearch(ToolParallelAiSearch.Builder parallelAiSearchBuilder) Setter for parallelAiSearch builder.parallelAiSearch: 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.
-
clearParallelAiSearch
Clears the value of parallelAiSearch field. -
urlContext
Setter for urlContext.urlContext: Optional. Tool to support URL context retrieval.
-
urlContext
Setter for urlContext builder.urlContext: Optional. Tool to support URL context retrieval.
-
clearUrlContext
Clears the value of urlContext field. -
mcpServers
Setter for mcpServers.mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.
-
mcpServers
Setter for mcpServers.mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.
-
mcpServers
Setter for mcpServers builder.mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.
-
clearMcpServers
Clears the value of mcpServers field. -
build
-