Package com.openai.models.realtime
Class RealtimeMcpToolCall.Error
-
- All Implemented Interfaces:
public final class RealtimeMcpToolCall.ErrorThe error from the tool call, if any.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRealtimeMcpToolCall.Error.VisitorAn interface that defines how to map each variant of Error to a value of type T.
-
Method Summary
-
-
Method Detail
-
protocol
final Optional<RealtimeMcpProtocolError> protocol()
-
toolExecution
final Optional<RealtimeMcpToolExecutionError> toolExecution()
-
http
final Optional<RealtimeMcphttpError> http()
-
isProtocol
final Boolean isProtocol()
-
isToolExecution
final Boolean isToolExecution()
-
asProtocol
final RealtimeMcpProtocolError asProtocol()
-
asToolExecution
final RealtimeMcpToolExecutionError asToolExecution()
-
asHttp
final RealtimeMcphttpError asHttp()
-
accept
final <T extends Any> T accept(RealtimeMcpToolCall.Error.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = error.accept(new Error.Visitor<Optional<String>>() { @Override public Optional<String> visitProtocol(RealtimeMcpProtocolError protocol) { return Optional.of(protocol.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RealtimeMcpToolCall.Error validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofProtocol
final static RealtimeMcpToolCall.Error ofProtocol(RealtimeMcpProtocolError protocol)
-
ofToolExecution
final static RealtimeMcpToolCall.Error ofToolExecution(RealtimeMcpToolExecutionError toolExecution)
-
ofHttp
final static RealtimeMcpToolCall.Error ofHttp(RealtimeMcphttpError http)
-
-
-
-