Package dev.dokimos.core.agents
Class ToolCall.Builder
java.lang.Object
dev.dokimos.core.agents.ToolCall.Builder
- Enclosing class:
ToolCall
Builder for constructing tool calls.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an argument.Sets all arguments.build()Builds the tool call.Adds a metadata entry.Sets all metadata.Sets the tool name.Sets the tool execution result.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 sameresultstring component used byresult(String).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the tool name.- Parameters:
name- the tool name- Returns:
- this builder
-
argument
Adds an argument.- Parameters:
key- the argument namevalue- the argument value- Returns:
- this builder
-
arguments
Sets all arguments.- Parameters:
arguments- the arguments map- Returns:
- this builder
-
result
Sets the tool execution result.- Parameters:
result- the result- Returns:
- this builder
-
resultJson
Sets the tool execution result from an arbitrary value by serializing it to compact (single-line) JSON and storing it in the sameresultstring component used byresult(String).Use for a tool that produced a structured value (a record, map, list, or other POJO) rather than a pre-rendered string. A
nullvalue serializes to the JSON literal"null".- Parameters:
value- the value to serialize as the result (may benull)- Returns:
- this builder
- Throws:
IllegalArgumentException- if the value cannot be serialized to JSON
-
metadata
Adds a metadata entry.- Parameters:
key- the metadata keyvalue- the metadata value- Returns:
- this builder
-
metadata
Sets all metadata.- Parameters:
metadata- the metadata map- Returns:
- this builder
-
build
Builds the tool call.- Returns:
- a new tool call
-