Class BaseTool
java.lang.Object
com.google.adk.tools.BaseTool
- Direct Known Subclasses:
AgentTool
,BaseRetrievalTool
,BuiltInCodeExecutionTool
,FunctionTool
,GoogleSearchTool
,LoadArtifactsTool
,McpTool
The base class for all ADK tools.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOptional
<com.google.genai.types.FunctionDeclaration> Gets theFunctionDeclaration
representation of this tool.boolean
name()
io.reactivex.rxjava3.core.Completable
processLlmRequest
(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Processes the outgoingLlmRequest.Builder
.runAsync
(Map<String, Object> args, ToolContext toolContext) Calls a tool.
-
Constructor Details
-
BaseTool
-
BaseTool
-
-
Method Details
-
name
-
description
-
longRunning
public boolean longRunning() -
declaration
Gets theFunctionDeclaration
representation of this tool. -
runAsync
-
processLlmRequest
@CanIgnoreReturnValue public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext) Processes the outgoingLlmRequest.Builder
.This implementation adds the current tool's
declaration()
to theGenerateContentConfig
within 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.
-