GeezerVison is showing adk.dev — NodeTool | ADK for TypeScript: API Reference - v2.5.0
A tool that executes a BaseNode (e.g. a Workflow or a function node)
on behalf of an LlmAgent. This is the inverse of ToolNode (which
exposes a tool as a workflow node): here a node/workflow is exposed to a model
as a callable tool.
The wrapped node MUST declare an inputSchema (the tool's parameter schema is
derived from it). When the model calls the tool, the node runs with a
NodeContext bridged from the tool's agent context (sharing the
invocation, session, and state); the node's structured output becomes the
tool result.
Ported from google/adk-python tools/_node_tool.py::NodeTool.
The tool is marked long-running so a node that pauses for input
(RequestInput) does not force a synthetic empty response.
Constructors
constructor
-
new NodeTool(node: BaseNode, name?: string, description?: string): NodeTool
Parameters
- node: BaseNode
Optionalname: string
Optionaldescription: string
Returns NodeTool
Properties
Readonly[BASE_TOOL_SIGNATURE_SYMBOL]
"[BASE_TOOL_SIGNATURE_SYMBOL]": true
A unique symbol to identify ADK base tool class.
Readonly[NODE_TOOL_SIGNATURE_SYMBOL]
"[NODE_TOOL_SIGNATURE_SYMBOL]": true
Brand identifying this object as a NodeTool (see isNodeTool).
Readonlydescription
description: string
ReadonlyisLongRunning
isLongRunning: boolean
Readonlyname
name: string
Accessors
apiVariant
-
The Google API LLM variant to use.
Methods
_getDeclaration
-
_getDeclaration(): FunctionDeclaration
Gets the OpenAPI specification of this tool in the form of a
FunctionDeclaration.
NOTE
- Required if subclass uses the default implementation of
processLlmRequest to add function declaration to LLM request.
- Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for
Gemini.
Returns FunctionDeclaration
The FunctionDeclaration of this tool, or undefined if it doesn't
need to be added to LlmRequest.config.
checkRequireConfirmation
-
checkRequireConfirmation( _args: Record<string, unknown>, _toolContext?: Context,): Promise<boolean>
Whether this tool needs a human to approve args before it runs.
The gate itself lives in the tool that owns it (see FunctionTool), but
the resume path has to ask the same question a turn later, to check that an
approval it is about to honour belongs to a tool that gates at all. A tool
that never gates returns false here, which is the safe default: an approval
naming it is meaningless and gets rejected rather than executed. Mirrors
Python's BaseTool.check_require_confirmation.
Parameters
- _args: Record<string, unknown>
The arguments the tool would run with.
Optional_toolContext: Context
The context of the call, when there is one.
Returns Promise<boolean>
Whether the call requires confirmation.
processLlmRequest
-
Processes the outgoing LLM request for this tool.
Use cases:
- Most common use case is adding this tool to the LLM request.
- Some tools may just preprocess the LLM request before it's sent out.
Returns Promise<void>
runAsync
-
Runs the tool with the given arguments and context.
NOTE
- Required if this tool needs to run at the client side.
- Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for
Gemini.
Returns Promise<unknown>
A promise that resolves to the tool response.
Constructors
Properties
Accessors
Methods