Class BetaToolUnion
-
- All Implemented Interfaces:
public final class BetaToolUnion
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaToolUnion.VisitorAn interface that defines how to map each variant of BetaToolUnion to a value of type T.
-
Method Summary
-
-
Method Detail
-
bash20241022
final Optional<BetaToolBash20241022> bash20241022()
-
bash20250124
final Optional<BetaToolBash20250124> bash20250124()
-
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.
-
computerUse20241022
final Optional<BetaToolComputerUse20241022> computerUse20241022()
-
memoryTool20250818
final Optional<BetaMemoryTool20250818> memoryTool20250818()
-
computerUse20250124
final Optional<BetaToolComputerUse20250124> computerUse20250124()
-
textEditor20241022
final Optional<BetaToolTextEditor20241022> textEditor20241022()
-
computerUse20251124
final Optional<BetaToolComputerUse20251124> computerUse20251124()
-
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`.
-
textEditor20250124
final Optional<BetaToolTextEditor20250124> textEditor20250124()
-
textEditor20250429
final Optional<BetaToolTextEditor20250429> textEditor20250429()
-
textEditor20250728
final Optional<BetaToolTextEditor20250728> textEditor20250728()
-
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()
-
searchToolBm25_20251119
final Optional<BetaToolSearchToolBm25_20251119> searchToolBm25_20251119()
-
searchToolRegex20251119
final Optional<BetaToolSearchToolRegex20251119> searchToolRegex20251119()
-
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.
-
cacheControl
final Optional<BetaCacheControlEphemeral> cacheControl()
-
deferLoading
final Optional<Boolean> deferLoading()
-
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()
-
isBetaTool
final Boolean isBetaTool()
-
isBash20241022
final Boolean isBash20241022()
-
isBash20250124
final Boolean isBash20250124()
-
isCodeExecutionTool20250522
final Boolean isCodeExecutionTool20250522()
-
isCodeExecutionTool20250825
final Boolean isCodeExecutionTool20250825()
-
isCodeExecutionTool20260120
final Boolean isCodeExecutionTool20260120()
-
isCodeExecutionTool20260521
final Boolean isCodeExecutionTool20260521()
-
isBrowserToolset20260801
final Boolean isBrowserToolset20260801()
-
isComputerUse20241022
final Boolean isComputerUse20241022()
-
isMemoryTool20250818
final Boolean isMemoryTool20250818()
-
isComputerUse20250124
final Boolean isComputerUse20250124()
-
isTextEditor20241022
final Boolean isTextEditor20241022()
-
isComputerUse20251124
final Boolean isComputerUse20251124()
-
isComputerToolset20260801
final Boolean isComputerToolset20260801()
-
isTextEditor20250124
final Boolean isTextEditor20250124()
-
isTextEditor20250429
final Boolean isTextEditor20250429()
-
isTextEditor20250728
final Boolean isTextEditor20250728()
-
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()
-
isSearchToolBm25_20251119
final Boolean isSearchToolBm25_20251119()
-
isSearchToolRegex20251119
final Boolean isSearchToolRegex20251119()
-
isMcpToolset
final Boolean isMcpToolset()
-
asBetaTool
final BetaTool asBetaTool()
-
asBash20241022
final BetaToolBash20241022 asBash20241022()
-
asBash20250124
final BetaToolBash20250124 asBash20250124()
-
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.
-
asComputerUse20241022
final BetaToolComputerUse20241022 asComputerUse20241022()
-
asMemoryTool20250818
final BetaMemoryTool20250818 asMemoryTool20250818()
-
asComputerUse20250124
final BetaToolComputerUse20250124 asComputerUse20250124()
-
asTextEditor20241022
final BetaToolTextEditor20241022 asTextEditor20241022()
-
asComputerUse20251124
final BetaToolComputerUse20251124 asComputerUse20251124()
-
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`.
-
asTextEditor20250124
final BetaToolTextEditor20250124 asTextEditor20250124()
-
asTextEditor20250429
final BetaToolTextEditor20250429 asTextEditor20250429()
-
asTextEditor20250728
final BetaToolTextEditor20250728 asTextEditor20250728()
-
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()
-
asSearchToolBm25_20251119
final BetaToolSearchToolBm25_20251119 asSearchToolBm25_20251119()
-
asSearchToolRegex20251119
final BetaToolSearchToolRegex20251119 asSearchToolRegex20251119()
-
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(BetaToolUnion.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 = betaToolUnion.accept(new BetaToolUnion.Visitor<Optional<String>>() { @Override public Optional<String> visitBetaTool(BetaTool betaTool) { return Optional.of(betaTool.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaToolUnion 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.
-
ofBetaTool
final static BetaToolUnion ofBetaTool(BetaTool betaTool)
-
ofBash20241022
final static BetaToolUnion ofBash20241022(BetaToolBash20241022 bash20241022)
-
ofBash20250124
final static BetaToolUnion ofBash20250124(BetaToolBash20250124 bash20250124)
-
ofCodeExecutionTool20250522
final static BetaToolUnion ofCodeExecutionTool20250522(BetaCodeExecutionTool20250522 codeExecutionTool20250522)
-
ofCodeExecutionTool20250825
final static BetaToolUnion ofCodeExecutionTool20250825(BetaCodeExecutionTool20250825 codeExecutionTool20250825)
-
ofCodeExecutionTool20260120
final static BetaToolUnion 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 BetaToolUnion ofCodeExecutionTool20260521(BetaCodeExecutionTool20260521 codeExecutionTool20260521)
Code execution tool with REPL state persistence.
-
ofBrowserToolset20260801
final static BetaToolUnion 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.
-
ofComputerUse20241022
final static BetaToolUnion ofComputerUse20241022(BetaToolComputerUse20241022 computerUse20241022)
-
ofMemoryTool20250818
final static BetaToolUnion ofMemoryTool20250818(BetaMemoryTool20250818 memoryTool20250818)
-
ofComputerUse20250124
final static BetaToolUnion ofComputerUse20250124(BetaToolComputerUse20250124 computerUse20250124)
-
ofTextEditor20241022
final static BetaToolUnion ofTextEditor20241022(BetaToolTextEditor20241022 textEditor20241022)
-
ofComputerUse20251124
final static BetaToolUnion ofComputerUse20251124(BetaToolComputerUse20251124 computerUse20251124)
-
ofComputerToolset20260801
final static BetaToolUnion 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`.
-
ofTextEditor20250124
final static BetaToolUnion ofTextEditor20250124(BetaToolTextEditor20250124 textEditor20250124)
-
ofTextEditor20250429
final static BetaToolUnion ofTextEditor20250429(BetaToolTextEditor20250429 textEditor20250429)
-
ofTextEditor20250728
final static BetaToolUnion ofTextEditor20250728(BetaToolTextEditor20250728 textEditor20250728)
-
ofWebSearchTool20250305
final static BetaToolUnion ofWebSearchTool20250305(BetaWebSearchTool20250305 webSearchTool20250305)
-
ofWebFetchTool20250910
final static BetaToolUnion ofWebFetchTool20250910(BetaWebFetchTool20250910 webFetchTool20250910)
-
ofWebSearchTool20260209
final static BetaToolUnion ofWebSearchTool20260209(BetaWebSearchTool20260209 webSearchTool20260209)
-
ofWebFetchTool20260209
final static BetaToolUnion ofWebFetchTool20260209(BetaWebFetchTool20260209 webFetchTool20260209)
-
ofWebFetchTool20260309
final static BetaToolUnion ofWebFetchTool20260309(BetaWebFetchTool20260309 webFetchTool20260309)
Web fetch tool with use_cache parameter for bypassing cached content.
-
ofWebSearchTool20260318
final static BetaToolUnion ofWebSearchTool20260318(BetaWebSearchTool20260318 webSearchTool20260318)
-
ofWebFetchTool20260318
final static BetaToolUnion ofWebFetchTool20260318(BetaWebFetchTool20260318 webFetchTool20260318)
-
ofAdvisorTool20260301
final static BetaToolUnion ofAdvisorTool20260301(BetaAdvisorTool20260301 advisorTool20260301)
-
ofAdvisorTool20260301
final static BetaToolUnion ofAdvisorTool20260301(Model model)
Returns an immutable instance of BetaToolUnion whose ofAdvisorTool20260301 variant is built from the given required model.
-
ofAdvisorTool20260301
final static BetaToolUnion 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.
-
ofSearchToolBm25_20251119
final static BetaToolUnion ofSearchToolBm25_20251119(BetaToolSearchToolBm25_20251119 searchToolBm25_20251119)
-
ofSearchToolBm25_20251119
final static BetaToolUnion ofSearchToolBm25_20251119(BetaToolSearchToolBm25_20251119.Type type)
Returns an immutable instance of BetaToolUnion whose ofSearchToolBm25_20251119 variant is built from the given required type.
-
ofSearchToolRegex20251119
final static BetaToolUnion ofSearchToolRegex20251119(BetaToolSearchToolRegex20251119 searchToolRegex20251119)
-
ofSearchToolRegex20251119
final static BetaToolUnion ofSearchToolRegex20251119(BetaToolSearchToolRegex20251119.Type type)
Returns an immutable instance of BetaToolUnion whose ofSearchToolRegex20251119 variant is built from the given required type.
-
ofMcpToolset
final static BetaToolUnion 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 BetaToolUnion ofMcpToolset(String mcpServerName)
Returns an immutable instance of BetaToolUnion whose ofMcpToolset variant is built from the given required mcpServerName.
-
-
-
-