Class ToolCall

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.ToolCall

public abstract class ToolCall extends JsonSerializable
A predicted server-side `ToolCall` returned from the model.

This message contains information about a tool that the model wants to invoke. The client is NOT expected to execute this `ToolCall`. Instead, the client should pass this `ToolCall` back to the API in a subsequent turn within a `Content` message, along with the corresponding `ToolResponse`.

  • Constructor Details

    • ToolCall

      public ToolCall()
  • Method Details

    • id

      public abstract Optional<String> id()
      Unique identifier of the tool call. The server returns the tool response with the matching `id`.
    • toolType

      public abstract Optional<ToolType> toolType()
      The type of tool that was called.
    • args

      public abstract Optional<Map<String,Object>> args()
      The tool call arguments. Example: {"arg1": "value1", "arg2": "value2"}.
    • builder

      public static ToolCall.Builder builder()
      Instantiates a builder for ToolCall.
    • toBuilder

      public abstract ToolCall.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static ToolCall fromJson(String jsonString)
      Deserializes a JSON string to a ToolCall object.