Class RealtimeSessionCreateResponse.Tool
-
- All Implemented Interfaces:
public final class RealtimeSessionCreateResponse.ToolGive the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRealtimeSessionCreateResponse.Tool.VisitorAn interface that defines how to map each variant of Tool to a value of type T.
public final classRealtimeSessionCreateResponse.Tool.McpToolGive the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
Method Summary
Modifier and Type Method Description final Optional<RealtimeFunctionTool>realtimeFunction()final Optional<RealtimeSessionCreateResponse.Tool.McpTool>mcp()Give the model access to additional tools via remote Model Context Protocol (MCP) servers. final BooleanisRealtimeFunction()final BooleanisMcp()final RealtimeFunctionToolasRealtimeFunction()final RealtimeSessionCreateResponse.Tool.McpToolasMcp()Give the model access to additional tools via remote Model Context Protocol (MCP) servers. final Optional<JsonValue>_json()final <T extends Any> Taccept(RealtimeSessionCreateResponse.Tool.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final RealtimeSessionCreateResponse.Toolvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RealtimeSessionCreateResponse.ToolofRealtimeFunction(RealtimeFunctionTool realtimeFunction)final static RealtimeSessionCreateResponse.ToolofMcp(RealtimeSessionCreateResponse.Tool.McpTool mcp)Give the model access to additional tools via remote Model Context Protocol (MCP) servers. -
-
Method Detail
-
realtimeFunction
final Optional<RealtimeFunctionTool> realtimeFunction()
-
mcp
final Optional<RealtimeSessionCreateResponse.Tool.McpTool> mcp()
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
isRealtimeFunction
final Boolean isRealtimeFunction()
-
asRealtimeFunction
final RealtimeFunctionTool asRealtimeFunction()
-
asMcp
final RealtimeSessionCreateResponse.Tool.McpTool asMcp()
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
accept
final <T extends Any> T accept(RealtimeSessionCreateResponse.Tool.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 = tool.accept(new Tool.Visitor<Optional<String>>() { @Override public Optional<String> visitRealtimeFunction(RealtimeFunctionTool realtimeFunction) { return Optional.of(realtimeFunction.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RealtimeSessionCreateResponse.Tool 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.
-
ofRealtimeFunction
final static RealtimeSessionCreateResponse.Tool ofRealtimeFunction(RealtimeFunctionTool realtimeFunction)
-
ofMcp
final static RealtimeSessionCreateResponse.Tool ofMcp(RealtimeSessionCreateResponse.Tool.McpTool mcp)
Give the model access to additional tools via remote Model Context Protocol (MCP) servers. Learn more about MCP.
-
-
-
-