ToolCallParam
public class ToolCallParam
io/agentscope/core/tool/ToolCallParam.java:46–259工具调用参数,让智能体以受控方式调用外部能力。位于 io.agentscope.core.tool 包。核心成员包括 getToolUseBlock、getInput、getAgent、getRuntimeContext、getContext、getEmitter。
Parameters for tool invocation.
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();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | ToolCallParam的构建器。 Builder for ToolCallParam. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public ToolUseBlock getToolUseBlock() | 获取工具使用块。 Gets the tool use block containing call metadata. |
public Map<String, Object> getInput() | 获取输入参数用于工具调用。 Gets the input parameters for the tool call. |
public Agent getAgent() | 获取智能体。 Gets the agent making the call. |
public RuntimeContext getRuntimeContext() | 获取运行时上下文用于此工具调用。 Gets the runtime context for this tool call. |
public ToolExecutionContext getContext()deprecated | 获取工具执行上下文。 Gets the tool execution context. |
public ToolEmitter getEmitter() | 获取ToolEmitter 用于流式工具输出。 Gets the ToolEmitter for streaming tool output. |
public static Builder builder()static | 返回构建器实例。 Creates a new builder for constructing ToolCallParam instances. |
public static Builder builder(ToolCallParam source)static | 返回构建器实例。 Creates a new builder initialized with values from an existing ToolCallParam. |
方法详情Method Detail
getToolUseBlock
public ToolUseBlock getToolUseBlock()
获取工具使用块。
Gets the tool use block containing call metadata.
ToolUseBlockio/agentscope/core/tool/ToolCallParam.java:67–69getInput
public Map<String, Object> getInput()
获取输入参数用于工具调用。
Gets the input parameters for the tool call.
Map<String, Object>io/agentscope/core/tool/ToolCallParam.java:76–78getAgent
public Agent getAgent()
获取智能体。
Gets the agent making the call.
Agentio/agentscope/core/tool/ToolCallParam.java:85–87getRuntimeContext
public RuntimeContext getRuntimeContext()
获取运行时上下文用于此工具调用。
Gets the runtime context for this tool call.
RuntimeContextio/agentscope/core/tool/ToolCallParam.java:94–96getContext
public ToolExecutionContext getContext()
获取工具执行上下文。
Gets the tool execution context.
ToolExecutionContextio/agentscope/core/tool/ToolCallParam.java:104–107getEmitter
public ToolEmitter getEmitter()
获取ToolEmitter 用于流式工具输出。
Gets the ToolEmitter for streaming tool output.
ToolEmitterio/agentscope/core/tool/ToolCallParam.java:117–119builder
public static Builder builder()
返回构建器实例。
Creates a new builder for constructing ToolCallParam instances.
Builderio/agentscope/core/tool/ToolCallParam.java:126–128builder
public static Builder builder(ToolCallParam source)
返回构建器实例。
Creates a new builder initialized with values from an existing ToolCallParam.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | ToolCallParam | 来源(类型 `ToolCallParam`)。The existing ToolCallParam to copy values from |
BuilderNullPointerException可能抛出 `NullPointerException`。if source is null
io/agentscope/core/tool/ToolCallParam.java:153–156嵌套类详情Nested Class Detail
Builder
public static class BuilderToolCallParam的构建器。位于 io.agentscope.core.tool 包。核心成员包括 toolUseBlock、input、agent、runtimeContext、context、emitter。
Builder for ToolCallParam.