Package com.tnsai.events
Record Class ToolCallEndEvent
java.lang.Object
java.lang.Record
com.tnsai.events.ToolCallEndEvent
- Record Components:
eventId- unique identifier for this eventtimestamp- when the event occurredtoolCallId- identifier matching the corresponding ToolCallStartEventtoolName- the name of the tool that was calledresult- the result of the tool execution (null if failed)success- true if the tool executed successfullyerror- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thedurationMsrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.eventId()Returns the value of theeventIdrecord component.static ToolCallEndEventCreates a failed tool call end event.final inthashCode()Returns a hash code value for this object.result()Returns the value of theresultrecord component.booleansuccess()Returns the value of thesuccessrecord component.static ToolCallEndEventCreates a successful tool call end event.Returns the value of thetimestamprecord component.Returns the value of thetoolCallIdrecord component.toolName()Returns the value of thetoolNamerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface com.tnsai.events.TnsAIEvent
eventType
-
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 aToolCallEndEventrecord class.- Parameters:
eventId- the value for theeventIdrecord componenttimestamp- the value for thetimestamprecord componenttoolCallId- the value for thetoolCallIdrecord componenttoolName- the value for thetoolNamerecord componentresult- the value for theresultrecord componentsuccess- the value for thesuccessrecord componenterror- the value for theerrorrecord componentdurationMs- the value for thedurationMsrecord 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 identifiertoolName- the tool nameresult- the execution resultdurationMs- 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 identifiertoolName- the tool nameerror- the error messagedurationMs- execution duration- Returns:
- new ToolCallEndEvent
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventId
Returns the value of theeventIdrecord component.- Specified by:
eventIdin interfaceTnsAIEvent- Returns:
- the value of the
eventIdrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Specified by:
timestampin interfaceTnsAIEvent- Returns:
- the value of the
timestamprecord component
-
toolCallId
Returns the value of thetoolCallIdrecord component.- Returns:
- the value of the
toolCallIdrecord component
-
toolName
Returns the value of thetoolNamerecord component.- Returns:
- the value of the
toolNamerecord component
-
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-
durationMs
public long durationMs()Returns the value of thedurationMsrecord component.- Returns:
- the value of the
durationMsrecord component
-