Class UrlContextTool
java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.UrlContextTool
A built-in tool that is automatically invoked by Gemini 2 and 3 models to retrieve information
from the given URLs.
This tool operates internally within the model and does not require or perform local code execution.
Usage example in an LlmAgent:
LlmAgent agent = LlmAgent.builder()
.tools(UrlContextTool.INSTANCE)
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseTool
BaseTool.ToolArgsConfig, BaseTool.ToolConfig -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.CompletableprocessLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Processes the outgoingLlmRequest.Builder.Methods inherited from class BaseTool
customMetadata, declaration, description, fromConfig, longRunning, name, runAsync, setCustomMetadata
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
UrlContextTool
public UrlContextTool()
-
-
Method Details
-
processLlmRequest
public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Description copied from class:BaseToolProcesses the outgoingLlmRequest.Builder.This implementation adds the current tool's
BaseTool.declaration()to theGenerateContentConfigwithin the builder. If a tool with function declarations already exists, the current tool's declaration is merged into it. Otherwise, a new tool definition with the current tool's declaration is created. The current tool itself is also added to the builder's internal list of tools. Override this method for processing the outgoing request.- Overrides:
processLlmRequestin classBaseTool
-