Record Class ToolCallStartEvent

java.lang.Object
java.lang.Record
com.tnsai.events.ToolCallStartEvent
Record Components:
eventId - unique identifier for this event
timestamp - when the event occurred
toolCallId - unique identifier for this tool call (use to match with end event)
toolName - the name of the tool being called
arguments - the arguments passed to the tool
All Implemented Interfaces:
TnsAIEvent

public record ToolCallStartEvent(String eventId, Instant timestamp, String toolCallId, String toolName, Map<String,Object> arguments) extends Record implements TnsAIEvent
Event indicating that a tool call has started.

ToolCallStartEvent is emitted when the agent begins executing a tool/action. It contains the tool name and arguments that will be used.

This event is paired with ToolCallEndEvent which indicates completion.

  • Constructor Details

    • ToolCallStartEvent

      public ToolCallStartEvent(String eventId, Instant timestamp, String toolCallId, String toolName, Map<String,Object> arguments)
      Creates an instance of a ToolCallStartEvent record class.
      Parameters:
      eventId - the value for the eventId record component
      timestamp - the value for the timestamp record component
      toolCallId - the value for the toolCallId record component
      toolName - the value for the toolName record component
      arguments - the value for the arguments record component
  • Method Details

    • of

      public static ToolCallStartEvent of(String toolCallId, String toolName, Map<String,Object> arguments)
      Creates a tool call start event.
      Parameters:
      toolCallId - unique identifier for this tool call
      toolName - the tool name
      arguments - the tool arguments
      Returns:
      new ToolCallStartEvent
    • of

      public static ToolCallStartEvent of(String toolName, Map<String,Object> arguments)
      Creates a tool call start event with auto-generated tool call ID.
      Parameters:
      toolName - the tool name
      arguments - the tool arguments
      Returns:
      new ToolCallStartEvent
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • eventId

      public String eventId()
      Returns the value of the eventId record component.
      Specified by:
      eventId in interface TnsAIEvent
      Returns:
      the value of the eventId record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TnsAIEvent
      Returns:
      the value of the timestamp record component
    • toolCallId

      public String toolCallId()
      Returns the value of the toolCallId record component.
      Returns:
      the value of the toolCallId record component
    • toolName

      public String toolName()
      Returns the value of the toolName record component.
      Returns:
      the value of the toolName record component
    • arguments

      public Map<String,Object> arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component