类 ToolCallParam

java.lang.Object
io.agentscope.core.tool.ToolCallParam

public class ToolCallParam extends Object
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();
 
  • 方法详细资料

    • getToolUseBlock

      public ToolUseBlock getToolUseBlock()
      Gets the tool use block containing call metadata.
      返回:
      The tool use block
    • getInput

      public Map<String,Object> getInput()
      Gets the input parameters for the tool call.
      返回:
      Unmodifiable map of input parameters
    • getAgent

      public Agent getAgent()
      Gets the agent making the call.
      返回:
      The agent, or null if not provided
    • getContext

      public ToolExecutionContext getContext()
      Gets the tool execution context.
      返回:
      The execution context, or null if not provided
    • getEmitter

      public ToolEmitter 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

      public static ToolCallParam.Builder builder()
      Creates a new builder for constructing ToolCallParam instances.
      返回:
      A new builder