Class ToolCall

  • All Implemented Interfaces:

    
    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`.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public abstract class ToolCall.Builder

      Builder for ToolCall.

    • Constructor Summary

      Constructors 
      Constructor Description
      ToolCall()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract Optional<String> id() Unique identifier of the tool call.
      abstract Optional<ToolType> toolType() The type of tool that was called.
      abstract Optional<Map<String, Object>> args() The tool call arguments.
      static ToolCall.Builder builder() Instantiates a builder for ToolCall.
      abstract ToolCall.Builder toBuilder() Creates a builder with the same values as this instance.
      static ToolCall fromJson(String jsonString) Deserializes a JSON string to a ToolCall 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