Package com.google.genai.types
Class ToolResponse
-
- All Implemented Interfaces:
public abstract class ToolResponse extends JsonSerializable
The output from a server-side `ToolCall` execution.
This message contains the results of a tool invocation that was initiated by a `ToolCall` from the model. The client should pass this `ToolResponse` back to the API in a subsequent turn within a `Content` message, along with the corresponding `ToolCall`.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classToolResponse.BuilderBuilder for ToolResponse.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description ToolResponse()
-
Method Summary
Modifier and Type Method Description abstract Optional<String>id()The identifier of the tool call this response is for. abstract Optional<ToolType>toolType()The type of tool that was called, matching the tool_type in the corresponding ToolCall. abstract Optional<Map<String, Object>>response()The tool response. static ToolResponse.Builderbuilder()Instantiates a builder for ToolResponse. abstract ToolResponse.BuildertoBuilder()Creates a builder with the same values as this instance. static ToolResponsefromJson(String jsonString)Deserializes a JSON string to a ToolResponse object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
toolType
abstract Optional<ToolType> toolType()
The type of tool that was called, matching the tool_type in the corresponding ToolCall.
-
builder
static ToolResponse.Builder builder()
Instantiates a builder for ToolResponse.
-
toBuilder
abstract ToolResponse.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static ToolResponse fromJson(String jsonString)
Deserializes a JSON string to a ToolResponse object.
-
-
-
-