Class BetaResponseToolUnion
-
- All Implemented Interfaces:
public final class BetaResponseToolUnion
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaResponseToolUnion.VisitorAn interface that defines how to map each variant of BetaResponseToolUnion to a value of type T.
-
Method Summary
-
-
Method Detail
-
betaResponseTool
final Optional<BetaResponseTool> betaResponseTool()
A custom tool definition, as sent.
-
toolBash20241022
final Optional<BetaToolBash20241022> toolBash20241022()
-
toolBash20250124
final Optional<BetaToolBash20250124> toolBash20250124()
-
codeExecutionTool20250522
final Optional<BetaCodeExecutionTool20250522> codeExecutionTool20250522()
-
codeExecutionTool20250825
final Optional<BetaCodeExecutionTool20250825> codeExecutionTool20250825()
-
codeExecutionTool20260120
final Optional<BetaCodeExecutionTool20260120> codeExecutionTool20260120()
A
toolsentry for the code execution tool, versioncode_execution_20260120. It adds REPL state persistence to versioncode_execution_20250825.REPL state persistence applies with programmatic tool calling. With it, the Python interpreter state, such as variable bindings, persists across requests that reuse the container.
See the code execution tool guide to learn what each tool version adds.
-
codeExecutionTool20260521
final Optional<BetaCodeExecutionTool20260521> codeExecutionTool20260521()
Code execution tool with REPL state persistence.
-
browserToolset20260801
final Optional<BetaBrowserToolset20260801> browserToolset20260801()
The browser toolset: a single
`tools[]`entry (carrying no`name`) that declares the browser tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema.
-
toolComputerUse20241022
final Optional<BetaToolComputerUse20241022> toolComputerUse20241022()
-
memoryTool20250818
final Optional<BetaMemoryTool20250818> memoryTool20250818()
-
toolComputerUse20250124
final Optional<BetaToolComputerUse20250124> toolComputerUse20250124()
-
toolTextEditor20241022
final Optional<BetaToolTextEditor20241022> toolTextEditor20241022()
-
toolComputerUse20251124
final Optional<BetaToolComputerUse20251124> toolComputerUse20251124()
-
computerToolset20260801
final Optional<BetaComputerToolset20260801> computerToolset20260801()
The computer toolset: a single
`tools[]`entry (carrying no`name`) that declares the computer tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema. Every member is enabled by default, zoom included. The single-tool options`display_number`and`enable_zoom`are not fields of a toolset entry — it carries only`type`,`configs`, and`cache_control`; zoom is controlled via`configs.zoom.enabled`.
-
toolTextEditor20250124
final Optional<BetaToolTextEditor20250124> toolTextEditor20250124()
-
toolTextEditor20250429
final Optional<BetaToolTextEditor20250429> toolTextEditor20250429()
-
toolTextEditor20250728
final Optional<BetaToolTextEditor20250728> toolTextEditor20250728()
-
webSearchTool20250305
final Optional<BetaWebSearchTool20250305> webSearchTool20250305()
-
webFetchTool20250910
final Optional<BetaWebFetchTool20250910> webFetchTool20250910()
-
webSearchTool20260209
final Optional<BetaWebSearchTool20260209> webSearchTool20260209()
-
webFetchTool20260209
final Optional<BetaWebFetchTool20260209> webFetchTool20260209()
-
webFetchTool20260309
final Optional<BetaWebFetchTool20260309> webFetchTool20260309()
Web fetch tool with use_cache parameter for bypassing cached content.
-
webSearchTool20260318
final Optional<BetaWebSearchTool20260318> webSearchTool20260318()
-
webFetchTool20260318
final Optional<BetaWebFetchTool20260318> webFetchTool20260318()
-
advisorTool20260301
final Optional<BetaAdvisorTool20260301> advisorTool20260301()
-
toolSearchToolBm25_20251119
final Optional<BetaToolSearchToolBm25_20251119> toolSearchToolBm25_20251119()
-
toolSearchToolRegex20251119
final Optional<BetaToolSearchToolRegex20251119> toolSearchToolRegex20251119()
-
mcpToolset
final Optional<BetaMcpToolset> mcpToolset()
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
-
toParam
final BetaToolUnion toParam()
-
deferLoading
final Optional<Boolean> deferLoading()
-
cacheControl
final Optional<BetaCacheControlEphemeral> cacheControl()
-
displayHeightPx
final Optional<Long> displayHeightPx()
-
displayWidthPx
final Optional<Long> displayWidthPx()
-
displayNumber
final Optional<Long> displayNumber()
-
allowedDomains
final Optional<List<String>> allowedDomains()
-
blockedDomains
final Optional<List<String>> blockedDomains()
-
userLocation
final Optional<BetaUserLocation> userLocation()
-
citations
final Optional<BetaCitationsConfigParam> citations()
-
maxContentTokens
final Optional<Long> maxContentTokens()
-
urlSources
final Optional<BetaWebFetchUrlSources> urlSources()
-
isBetaResponseTool
final Boolean isBetaResponseTool()
-
isToolBash20241022
final Boolean isToolBash20241022()
-
isToolBash20250124
final Boolean isToolBash20250124()
-
isCodeExecutionTool20250522
final Boolean isCodeExecutionTool20250522()
-
isCodeExecutionTool20250825
final Boolean isCodeExecutionTool20250825()
-
isCodeExecutionTool20260120
final Boolean isCodeExecutionTool20260120()
-
isCodeExecutionTool20260521
final Boolean isCodeExecutionTool20260521()
-
isBrowserToolset20260801
final Boolean isBrowserToolset20260801()
-
isToolComputerUse20241022
final Boolean isToolComputerUse20241022()
-
isMemoryTool20250818
final Boolean isMemoryTool20250818()
-
isToolComputerUse20250124
final Boolean isToolComputerUse20250124()
-
isToolTextEditor20241022
final Boolean isToolTextEditor20241022()
-
isToolComputerUse20251124
final Boolean isToolComputerUse20251124()
-
isComputerToolset20260801
final Boolean isComputerToolset20260801()
-
isToolTextEditor20250124
final Boolean isToolTextEditor20250124()
-
isToolTextEditor20250429
final Boolean isToolTextEditor20250429()
-
isToolTextEditor20250728
final Boolean isToolTextEditor20250728()
-
isWebSearchTool20250305
final Boolean isWebSearchTool20250305()
-
isWebFetchTool20250910
final Boolean isWebFetchTool20250910()
-
isWebSearchTool20260209
final Boolean isWebSearchTool20260209()
-
isWebFetchTool20260209
final Boolean isWebFetchTool20260209()
-
isWebFetchTool20260309
final Boolean isWebFetchTool20260309()
-
isWebSearchTool20260318
final Boolean isWebSearchTool20260318()
-
isWebFetchTool20260318
final Boolean isWebFetchTool20260318()
-
isAdvisorTool20260301
final Boolean isAdvisorTool20260301()
-
isToolSearchToolBm25_20251119
final Boolean isToolSearchToolBm25_20251119()
-
isToolSearchToolRegex20251119
final Boolean isToolSearchToolRegex20251119()
-
isMcpToolset
final Boolean isMcpToolset()
-
asBetaResponseTool
final BetaResponseTool asBetaResponseTool()
A custom tool definition, as sent.
-
asToolBash20241022
final BetaToolBash20241022 asToolBash20241022()
-
asToolBash20250124
final BetaToolBash20250124 asToolBash20250124()
-
asCodeExecutionTool20250522
final BetaCodeExecutionTool20250522 asCodeExecutionTool20250522()
-
asCodeExecutionTool20250825
final BetaCodeExecutionTool20250825 asCodeExecutionTool20250825()
-
asCodeExecutionTool20260120
final BetaCodeExecutionTool20260120 asCodeExecutionTool20260120()
A
toolsentry for the code execution tool, versioncode_execution_20260120. It adds REPL state persistence to versioncode_execution_20250825.REPL state persistence applies with programmatic tool calling. With it, the Python interpreter state, such as variable bindings, persists across requests that reuse the container.
See the code execution tool guide to learn what each tool version adds.
-
asCodeExecutionTool20260521
final BetaCodeExecutionTool20260521 asCodeExecutionTool20260521()
Code execution tool with REPL state persistence.
-
asBrowserToolset20260801
final BetaBrowserToolset20260801 asBrowserToolset20260801()
The browser toolset: a single
`tools[]`entry (carrying no`name`) that declares the browser tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema.
-
asToolComputerUse20241022
final BetaToolComputerUse20241022 asToolComputerUse20241022()
-
asMemoryTool20250818
final BetaMemoryTool20250818 asMemoryTool20250818()
-
asToolComputerUse20250124
final BetaToolComputerUse20250124 asToolComputerUse20250124()
-
asToolTextEditor20241022
final BetaToolTextEditor20241022 asToolTextEditor20241022()
-
asToolComputerUse20251124
final BetaToolComputerUse20251124 asToolComputerUse20251124()
-
asComputerToolset20260801
final BetaComputerToolset20260801 asComputerToolset20260801()
The computer toolset: a single
`tools[]`entry (carrying no`name`) that declares the computer tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema. Every member is enabled by default, zoom included. The single-tool options`display_number`and`enable_zoom`are not fields of a toolset entry — it carries only`type`,`configs`, and`cache_control`; zoom is controlled via`configs.zoom.enabled`.
-
asToolTextEditor20250124
final BetaToolTextEditor20250124 asToolTextEditor20250124()
-
asToolTextEditor20250429
final BetaToolTextEditor20250429 asToolTextEditor20250429()
-
asToolTextEditor20250728
final BetaToolTextEditor20250728 asToolTextEditor20250728()
-
asWebSearchTool20250305
final BetaWebSearchTool20250305 asWebSearchTool20250305()
-
asWebFetchTool20250910
final BetaWebFetchTool20250910 asWebFetchTool20250910()
-
asWebSearchTool20260209
final BetaWebSearchTool20260209 asWebSearchTool20260209()
-
asWebFetchTool20260209
final BetaWebFetchTool20260209 asWebFetchTool20260209()
-
asWebFetchTool20260309
final BetaWebFetchTool20260309 asWebFetchTool20260309()
Web fetch tool with use_cache parameter for bypassing cached content.
-
asWebSearchTool20260318
final BetaWebSearchTool20260318 asWebSearchTool20260318()
-
asWebFetchTool20260318
final BetaWebFetchTool20260318 asWebFetchTool20260318()
-
asAdvisorTool20260301
final BetaAdvisorTool20260301 asAdvisorTool20260301()
-
asToolSearchToolBm25_20251119
final BetaToolSearchToolBm25_20251119 asToolSearchToolBm25_20251119()
-
asToolSearchToolRegex20251119
final BetaToolSearchToolRegex20251119 asToolSearchToolRegex20251119()
-
asMcpToolset
final BetaMcpToolset asMcpToolset()
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
-
accept
final <T extends Any> T accept(BetaResponseToolUnion.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.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = betaResponseToolUnion.accept(new BetaResponseToolUnion.Visitor<Optional<String>>() { @Override public Optional<String> visitBetaResponseTool(BetaResponseTool betaResponseTool) { return Optional.of(betaResponseTool.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaResponseToolUnion 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.
-
ofBetaResponseTool
final static BetaResponseToolUnion ofBetaResponseTool(BetaResponseTool betaResponseTool)
A custom tool definition, as sent.
-
ofToolBash20241022
final static BetaResponseToolUnion ofToolBash20241022(BetaToolBash20241022 toolBash20241022)
-
ofToolBash20250124
final static BetaResponseToolUnion ofToolBash20250124(BetaToolBash20250124 toolBash20250124)
-
ofCodeExecutionTool20250522
final static BetaResponseToolUnion ofCodeExecutionTool20250522(BetaCodeExecutionTool20250522 codeExecutionTool20250522)
-
ofCodeExecutionTool20250825
final static BetaResponseToolUnion ofCodeExecutionTool20250825(BetaCodeExecutionTool20250825 codeExecutionTool20250825)
-
ofCodeExecutionTool20260120
final static BetaResponseToolUnion ofCodeExecutionTool20260120(BetaCodeExecutionTool20260120 codeExecutionTool20260120)
A
toolsentry for the code execution tool, versioncode_execution_20260120. It adds REPL state persistence to versioncode_execution_20250825.REPL state persistence applies with programmatic tool calling. With it, the Python interpreter state, such as variable bindings, persists across requests that reuse the container.
See the code execution tool guide to learn what each tool version adds.
-
ofCodeExecutionTool20260521
final static BetaResponseToolUnion ofCodeExecutionTool20260521(BetaCodeExecutionTool20260521 codeExecutionTool20260521)
Code execution tool with REPL state persistence.
-
ofBrowserToolset20260801
final static BetaResponseToolUnion ofBrowserToolset20260801(BetaBrowserToolset20260801 browserToolset20260801)
The browser toolset: a single
`tools[]`entry (carrying no`name`) that declares the browser tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema.
-
ofToolComputerUse20241022
final static BetaResponseToolUnion ofToolComputerUse20241022(BetaToolComputerUse20241022 toolComputerUse20241022)
-
ofMemoryTool20250818
final static BetaResponseToolUnion ofMemoryTool20250818(BetaMemoryTool20250818 memoryTool20250818)
-
ofToolComputerUse20250124
final static BetaResponseToolUnion ofToolComputerUse20250124(BetaToolComputerUse20250124 toolComputerUse20250124)
-
ofToolTextEditor20241022
final static BetaResponseToolUnion ofToolTextEditor20241022(BetaToolTextEditor20241022 toolTextEditor20241022)
-
ofToolComputerUse20251124
final static BetaResponseToolUnion ofToolComputerUse20251124(BetaToolComputerUse20251124 toolComputerUse20251124)
-
ofComputerToolset20260801
final static BetaResponseToolUnion ofComputerToolset20260801(BetaComputerToolset20260801 computerToolset20260801)
The computer toolset: a single
`tools[]`entry (carrying no`name`) that declares the computer tool family. The model is served the family's tool with any members disabled via`configs`removed from its schema. Every member is enabled by default, zoom included. The single-tool options`display_number`and`enable_zoom`are not fields of a toolset entry — it carries only`type`,`configs`, and`cache_control`; zoom is controlled via`configs.zoom.enabled`.
-
ofToolTextEditor20250124
final static BetaResponseToolUnion ofToolTextEditor20250124(BetaToolTextEditor20250124 toolTextEditor20250124)
-
ofToolTextEditor20250429
final static BetaResponseToolUnion ofToolTextEditor20250429(BetaToolTextEditor20250429 toolTextEditor20250429)
-
ofToolTextEditor20250728
final static BetaResponseToolUnion ofToolTextEditor20250728(BetaToolTextEditor20250728 toolTextEditor20250728)
-
ofWebSearchTool20250305
final static BetaResponseToolUnion ofWebSearchTool20250305(BetaWebSearchTool20250305 webSearchTool20250305)
-
ofWebFetchTool20250910
final static BetaResponseToolUnion ofWebFetchTool20250910(BetaWebFetchTool20250910 webFetchTool20250910)
-
ofWebSearchTool20260209
final static BetaResponseToolUnion ofWebSearchTool20260209(BetaWebSearchTool20260209 webSearchTool20260209)
-
ofWebFetchTool20260209
final static BetaResponseToolUnion ofWebFetchTool20260209(BetaWebFetchTool20260209 webFetchTool20260209)
-
ofWebFetchTool20260309
final static BetaResponseToolUnion ofWebFetchTool20260309(BetaWebFetchTool20260309 webFetchTool20260309)
Web fetch tool with use_cache parameter for bypassing cached content.
-
ofWebSearchTool20260318
final static BetaResponseToolUnion ofWebSearchTool20260318(BetaWebSearchTool20260318 webSearchTool20260318)
-
ofWebFetchTool20260318
final static BetaResponseToolUnion ofWebFetchTool20260318(BetaWebFetchTool20260318 webFetchTool20260318)
-
ofAdvisorTool20260301
final static BetaResponseToolUnion ofAdvisorTool20260301(BetaAdvisorTool20260301 advisorTool20260301)
-
ofAdvisorTool20260301
final static BetaResponseToolUnion ofAdvisorTool20260301(Model model)
Returns an immutable instance of BetaResponseToolUnion whose ofAdvisorTool20260301 variant is built from the given required model.
-
ofAdvisorTool20260301
final static BetaResponseToolUnion ofAdvisorTool20260301(String value)
Alias for calling ofAdvisorTool20260301 with
Model.of(value).You should usually call ofAdvisorTool20260301 with a well-typed Model constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
ofToolSearchToolBm25_20251119
final static BetaResponseToolUnion ofToolSearchToolBm25_20251119(BetaToolSearchToolBm25_20251119 toolSearchToolBm25_20251119)
-
ofToolSearchToolBm25_20251119
final static BetaResponseToolUnion ofToolSearchToolBm25_20251119(BetaToolSearchToolBm25_20251119.Type type)
Returns an immutable instance of BetaResponseToolUnion whose ofToolSearchToolBm25_20251119 variant is built from the given required type.
-
ofToolSearchToolRegex20251119
final static BetaResponseToolUnion ofToolSearchToolRegex20251119(BetaToolSearchToolRegex20251119 toolSearchToolRegex20251119)
-
ofToolSearchToolRegex20251119
final static BetaResponseToolUnion ofToolSearchToolRegex20251119(BetaToolSearchToolRegex20251119.Type type)
Returns an immutable instance of BetaResponseToolUnion whose ofToolSearchToolRegex20251119 variant is built from the given required type.
-
ofMcpToolset
final static BetaResponseToolUnion ofMcpToolset(BetaMcpToolset mcpToolset)
Configuration for a group of tools from an MCP server.
Allows configuring enabled status and defer_loading for all tools from an MCP server, with optional per-tool overrides.
-
ofMcpToolset
final static BetaResponseToolUnion ofMcpToolset(String mcpServerName)
Returns an immutable instance of BetaResponseToolUnion whose ofMcpToolset variant is built from the given required mcpServerName.
-
-
-
-