Record Class ToolCallEndEvent

java.lang.Object
java.lang.Record
com.tnsai.events.ToolCallEndEvent
Record Components:
eventId - unique identifier for this event
timestamp - when the event occurred
toolCallId - identifier matching the corresponding ToolCallStartEvent
toolName - the name of the tool that was called
result - the result of the tool execution (null if failed)
success - true if the tool executed successfully
error - error message if execution failed (null if success)
durationMs - execution duration in milliseconds
All Implemented Interfaces:
TnsAIEvent

public record ToolCallEndEvent(String eventId, Instant timestamp, String toolCallId, String toolName, Object result, boolean success, String error, long durationMs) extends Record implements TnsAIEvent
Event indicating that a tool call has completed.

ToolCallEndEvent is emitted when a tool/action execution finishes, either successfully or with an error.

This event is paired with ToolCallStartEvent.

  • Constructor Details

    • ToolCallEndEvent

      public ToolCallEndEvent(String eventId, Instant timestamp, String toolCallId, String toolName, Object result, boolean success, String error, long durationMs)
      Creates an instance of a ToolCallEndEvent 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
      result - the value for the result record component
      success - the value for the success record component
      error - the value for the error record component
      durationMs - the value for the durationMs record component
  • Method Details

    • success

      public static ToolCallEndEvent success(String toolCallId, String toolName, Object result, long durationMs)
      Creates a successful tool call end event.
      Parameters:
      toolCallId - the tool call identifier
      toolName - the tool name
      result - the execution result
      durationMs - execution duration
      Returns:
      new ToolCallEndEvent
    • failure

      public static ToolCallEndEvent failure(String toolCallId, String toolName, String error, long durationMs)
      Creates a failed tool call end event.
      Parameters:
      toolCallId - the tool call identifier
      toolName - the tool name
      error - the error message
      durationMs - execution duration
      Returns:
      new ToolCallEndEvent
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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
    • result

      public Object result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • success

      public boolean success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • durationMs

      public long durationMs()
      Returns the value of the durationMs record component.
      Returns:
      the value of the durationMs record component