类 ToolCallParam
This class encapsulates all the information needed to call a tool, including the tool use block (containing metadata like call ID and tool name), input parameters, and the calling agent.
Using a parameter object instead of multiple method parameters provides better extensibility - new parameters can be added without breaking existing code.
Example usage:
ToolCallParam param = ToolCallParam.builder()
.toolUseBlock(toolUseBlock)
.input(Map.of("key", "value"))
.agent(agent)
.build();
ToolResultBlock result = tool.callAsync(param).block();
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明static ToolCallParam.Builderbuilder()Creates a new builder for constructing ToolCallParam instances.static ToolCallParam.Builderbuilder(ToolCallParam source) Creates a new builder initialized with values from an existing ToolCallParam.getAgent()Gets the agent making the call.已过时。Gets the ToolEmitter for streaming tool output.getInput()Gets the input parameters for the tool call.Gets the runtime context for this tool call.Gets the tool use block containing call metadata.
-
方法详细资料
-
getToolUseBlock
Gets the tool use block containing call metadata.- 返回:
- The tool use block
-
getInput
Gets the input parameters for the tool call.- 返回:
- Unmodifiable map of input parameters
-
getAgent
Gets the agent making the call.- 返回:
- The agent, or null if not provided
-
getRuntimeContext
Gets the runtime context for this tool call.- 返回:
- The runtime context, or null if not provided
-
getContext
已过时。UsegetRuntimeContext()instead.Gets the tool execution context.- 返回:
- The execution context derived from RuntimeContext, or null
-
getEmitter
Gets the ToolEmitter for streaming tool output.Tools can use this emitter to send intermediate progress updates during execution. If no emitter is configured, returns a no-op emitter that silently discards chunks.
- 返回:
- The ToolEmitter, never null
-
builder
Creates a new builder for constructing ToolCallParam instances.- 返回:
- A new builder
-
builder
Creates a new builder initialized with values from an existing ToolCallParam.This is useful for creating a modified copy of an existing parameter object. The builder copies all values from the source object, allowing selective modifications before building a new instance.
Example usage:
ToolCallParam original = ...; ToolCallParam modified = ToolCallParam.builder(original) .input(Map.of("newKey", "newValue")) .build();Note: The input map structure is copied so that entries can be modified independently, but nested values (typed as Object) remain shared. Immutable fields (toolUseBlock, agent, context, emitter) are shared by reference.
- 参数:
source- The existing ToolCallParam to copy values from- 返回:
- A new builder pre-populated with the source's values
- 抛出:
NullPointerException- if source is null
-
getRuntimeContext()instead.