Package com.tnsai.mcp.server.event
Record Class ToolErrorEvent
java.lang.Object
java.lang.Record
com.tnsai.mcp.server.event.ToolErrorEvent
- Record Components:
toolName- the name of the tool that failedcategory- the error category for client-side recovery decisionsmessage- safe, human-readable error descriptiontimestamp- when the error occurredrequestId- the JSON-RPC request ID (if available)
public record ToolErrorEvent(String toolName, ToolErrorCategory category, String message, Instant timestamp, Long requestId)
extends Record
Structured error event emitted when an MCP tool execution fails.
Contains the error category, tool name, and a safe error message (no sensitive stack traces or internal details).
-
Constructor Summary
ConstructorsConstructorDescriptionToolErrorEvent(String toolName, ToolErrorCategory category, String message, Instant timestamp, Long requestId) Creates an instance of aToolErrorEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncategory()Returns the value of thecategoryrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns whether this error is typically retriable.message()Returns the value of themessagerecord component.static ToolErrorEventof(String toolName, ToolErrorCategory category, String message) Creates an error event with auto-generated timestamp.static ToolErrorEventof(String toolName, ToolErrorCategory category, String message, Long requestId) Creates an error event with a request ID.Returns the value of therequestIdrecord component.Returns the value of thetimestamprecord component.toolName()Returns the value of thetoolNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ToolErrorEvent
public ToolErrorEvent(String toolName, ToolErrorCategory category, String message, Instant timestamp, Long requestId) Creates an instance of aToolErrorEventrecord class.
-
-
Method Details
-
of
Creates an error event with auto-generated timestamp. -
of
public static ToolErrorEvent of(String toolName, ToolErrorCategory category, String message, Long requestId) Creates an error event with a request ID. -
isRetriable
public boolean isRetriable()Returns whether this error is typically retriable. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
toolName
Returns the value of thetoolNamerecord component.- Returns:
- the value of the
toolNamerecord component
-
category
Returns the value of thecategoryrecord component.- Returns:
- the value of the
categoryrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
requestId
Returns the value of therequestIdrecord component.- Returns:
- the value of the
requestIdrecord component
-