Class BetaWebFetchUrlSources.ServerToolResults
-
- All Implemented Interfaces:
public final class BetaWebFetchUrlSources.ServerToolResultsWhich server tools' results contribute fetchable URLs: "all", "none", or an only or except list of server tool names from tools[]; only web_search and web_fetch results ever contribute.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaWebFetchUrlSources.ServerToolResults.VisitorAn interface that defines how to map each variant of ServerToolResults to a value of type T.
public final classBetaWebFetchUrlSources.ServerToolResults.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaWebFetchUrlSourceAll>all()The `url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.final Optional<BetaWebFetchUrlSourceNone>none()The `url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.final Optional<BetaWebFetchUrlSourceOnly>only()The tool filter variant under which only the named tools' results contribute. final Optional<BetaWebFetchUrlSourceExcept>except()The tool filter variant under which every result but the named tools' contributes. final Optional<JsonValue>_json()final BetaWebFetchUrlSources.ServerToolResults.Typetype()final Optional<List<BetaWebFetchUrlSourceToolReference>>tools()final BooleanisAll()final BooleanisNone()final BooleanisOnly()final BooleanisExcept()final BetaWebFetchUrlSourceAllasAll()The `url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.final BetaWebFetchUrlSourceNoneasNone()The `url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.final BetaWebFetchUrlSourceOnlyasOnly()The tool filter variant under which only the named tools' results contribute. final BetaWebFetchUrlSourceExceptasExcept()The tool filter variant under which every result but the named tools' contributes. final <T extends Any> Taccept(BetaWebFetchUrlSources.ServerToolResults.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaWebFetchUrlSources.ServerToolResultsvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaWebFetchUrlSources.ServerToolResultsofAll(BetaWebFetchUrlSourceAll all)The `url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.final static BetaWebFetchUrlSources.ServerToolResultsofNone(BetaWebFetchUrlSourceNone none)The `url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.final static BetaWebFetchUrlSources.ServerToolResultsofOnly(BetaWebFetchUrlSourceOnly only)The tool filter variant under which only the named tools' results contribute. final static BetaWebFetchUrlSources.ServerToolResultsofOnly(List<BetaWebFetchUrlSourceToolReference> tools)Returns an immutable instance of ServerToolResults whose ofOnly variant is built from the given required tools. final static BetaWebFetchUrlSources.ServerToolResultsofExcept(BetaWebFetchUrlSourceExcept except)The tool filter variant under which every result but the named tools' contributes. final static BetaWebFetchUrlSources.ServerToolResultsofExcept(List<BetaWebFetchUrlSourceToolReference> tools)Returns an immutable instance of ServerToolResults whose ofExcept variant is built from the given required tools. -
-
Method Detail
-
all
final Optional<BetaWebFetchUrlSourceAll> all()
The
`url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.
-
none
final Optional<BetaWebFetchUrlSourceNone> none()
The
`url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
-
only
final Optional<BetaWebFetchUrlSourceOnly> only()
The tool filter variant under which only the named tools' results contribute.
-
except
final Optional<BetaWebFetchUrlSourceExcept> except()
The tool filter variant under which every result but the named tools' contributes.
-
type
final BetaWebFetchUrlSources.ServerToolResults.Type type()
-
tools
final Optional<List<BetaWebFetchUrlSourceToolReference>> tools()
-
asAll
final BetaWebFetchUrlSourceAll asAll()
The
`url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.
-
asNone
final BetaWebFetchUrlSourceNone asNone()
The
`url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
-
asOnly
final BetaWebFetchUrlSourceOnly asOnly()
The tool filter variant under which only the named tools' results contribute.
-
asExcept
final BetaWebFetchUrlSourceExcept asExcept()
The tool filter variant under which every result but the named tools' contributes.
-
accept
final <T extends Any> T accept(BetaWebFetchUrlSources.ServerToolResults.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 = serverToolResults.accept(new ServerToolResults.Visitor<Optional<String>>() { @Override public Optional<String> visitAll(BetaWebFetchUrlSourceAll all) { return Optional.of(all.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaWebFetchUrlSources.ServerToolResults 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.
-
ofAll
final static BetaWebFetchUrlSources.ServerToolResults ofAll(BetaWebFetchUrlSourceAll all)
The
`url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.
-
ofNone
final static BetaWebFetchUrlSources.ServerToolResults ofNone(BetaWebFetchUrlSourceNone none)
The
`url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.
-
ofOnly
final static BetaWebFetchUrlSources.ServerToolResults ofOnly(BetaWebFetchUrlSourceOnly only)
The tool filter variant under which only the named tools' results contribute.
-
ofOnly
final static BetaWebFetchUrlSources.ServerToolResults ofOnly(List<BetaWebFetchUrlSourceToolReference> tools)
Returns an immutable instance of ServerToolResults whose ofOnly variant is built from the given required tools.
-
ofExcept
final static BetaWebFetchUrlSources.ServerToolResults ofExcept(BetaWebFetchUrlSourceExcept except)
The tool filter variant under which every result but the named tools' contributes.
-
ofExcept
final static BetaWebFetchUrlSources.ServerToolResults ofExcept(List<BetaWebFetchUrlSourceToolReference> tools)
Returns an immutable instance of ServerToolResults whose ofExcept variant is built from the given required tools.
-
-
-
-