Class ToolCall.Builder

java.lang.Object
dev.dokimos.core.agents.ToolCall.Builder
Enclosing class:
ToolCall

public static class ToolCall.Builder extends Object
Builder for constructing tool calls.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • name

      public ToolCall.Builder name(String name)
      Sets the tool name.
      Parameters:
      name - the tool name
      Returns:
      this builder
    • argument

      public ToolCall.Builder argument(String key, Object value)
      Adds an argument.
      Parameters:
      key - the argument name
      value - the argument value
      Returns:
      this builder
    • arguments

      public ToolCall.Builder arguments(Map<String,Object> arguments)
      Sets all arguments.
      Parameters:
      arguments - the arguments map
      Returns:
      this builder
    • result

      public ToolCall.Builder result(String result)
      Sets the tool execution result.
      Parameters:
      result - the result
      Returns:
      this builder
    • resultJson

      public ToolCall.Builder resultJson(Object value)
      Sets the tool execution result from an arbitrary value by serializing it to compact (single-line) JSON and storing it in the same result string component used by result(String).

      Use for a tool that produced a structured value (a record, map, list, or other POJO) rather than a pre-rendered string. A null value serializes to the JSON literal "null".

      Parameters:
      value - the value to serialize as the result (may be null)
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the value cannot be serialized to JSON
    • metadata

      public ToolCall.Builder metadata(String key, Object value)
      Adds a metadata entry.
      Parameters:
      key - the metadata key
      value - the metadata value
      Returns:
      this builder
    • metadata

      public ToolCall.Builder metadata(Map<String,Object> metadata)
      Sets all metadata.
      Parameters:
      metadata - the metadata map
      Returns:
      this builder
    • build

      public ToolCall build()
      Builds the tool call.
      Returns:
      a new tool call