Class WebFetchUrlSources.ServerToolResults
-
- All Implemented Interfaces:
public final class WebFetchUrlSources.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 interfaceWebFetchUrlSources.ServerToolResults.VisitorAn interface that defines how to map each variant of ServerToolResults to a value of type T.
public final classWebFetchUrlSources.ServerToolResults.Type
-
Method Summary
Modifier and Type Method Description final Optional<WebFetchUrlSourceAll>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<WebFetchUrlSourceNone>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<WebFetchUrlSourceOnly>only()The tool filter variant under which only the named tools' results contribute. final Optional<WebFetchUrlSourceExcept>except()The tool filter variant under which every result but the named tools' contributes. final Optional<JsonValue>_json()final WebFetchUrlSources.ServerToolResults.Typetype()final Optional<List<WebFetchUrlSourceToolReference>>tools()final BooleanisAll()final BooleanisNone()final BooleanisOnly()final BooleanisExcept()final WebFetchUrlSourceAllasAll()The `url_sources`variant under which a source contributes in full: every result of the tool filter's source, or all user input.final WebFetchUrlSourceNoneasNone()The `url_sources`variant under which a source contributes nothing: no result of the tool filter's source, or no user input.final WebFetchUrlSourceOnlyasOnly()The tool filter variant under which only the named tools' results contribute. final WebFetchUrlSourceExceptasExcept()The tool filter variant under which every result but the named tools' contributes. final <T extends Any> Taccept(WebFetchUrlSources.ServerToolResults.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final WebFetchUrlSources.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 WebFetchUrlSources.ServerToolResultsofAll(WebFetchUrlSourceAll 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 WebFetchUrlSources.ServerToolResultsofNone(WebFetchUrlSourceNone 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 WebFetchUrlSources.ServerToolResultsofOnly(WebFetchUrlSourceOnly only)The tool filter variant under which only the named tools' results contribute. final static WebFetchUrlSources.ServerToolResultsofOnly(List<WebFetchUrlSourceToolReference> tools)Returns an immutable instance of ServerToolResults whose ofOnly variant is built from the given required tools. final static WebFetchUrlSources.ServerToolResultsofExcept(WebFetchUrlSourceExcept except)The tool filter variant under which every result but the named tools' contributes. final static WebFetchUrlSources.ServerToolResultsofExcept(List<WebFetchUrlSourceToolReference> tools)Returns an immutable instance of ServerToolResults whose ofExcept variant is built from the given required tools. -
-
Method Detail
-
all
final Optional<WebFetchUrlSourceAll> 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<WebFetchUrlSourceNone> 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<WebFetchUrlSourceOnly> only()
The tool filter variant under which only the named tools' results contribute.
-
except
final Optional<WebFetchUrlSourceExcept> except()
The tool filter variant under which every result but the named tools' contributes.
-
type
final WebFetchUrlSources.ServerToolResults.Type type()
-
tools
final Optional<List<WebFetchUrlSourceToolReference>> tools()
-
asAll
final WebFetchUrlSourceAll 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 WebFetchUrlSourceNone 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 WebFetchUrlSourceOnly asOnly()
The tool filter variant under which only the named tools' results contribute.
-
asExcept
final WebFetchUrlSourceExcept asExcept()
The tool filter variant under which every result but the named tools' contributes.
-
accept
final <T extends Any> T accept(WebFetchUrlSources.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(WebFetchUrlSourceAll all) { return Optional.of(all.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final WebFetchUrlSources.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 WebFetchUrlSources.ServerToolResults ofAll(WebFetchUrlSourceAll 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 WebFetchUrlSources.ServerToolResults ofNone(WebFetchUrlSourceNone 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 WebFetchUrlSources.ServerToolResults ofOnly(WebFetchUrlSourceOnly only)
The tool filter variant under which only the named tools' results contribute.
-
ofOnly
final static WebFetchUrlSources.ServerToolResults ofOnly(List<WebFetchUrlSourceToolReference> tools)
Returns an immutable instance of ServerToolResults whose ofOnly variant is built from the given required tools.
-
ofExcept
final static WebFetchUrlSources.ServerToolResults ofExcept(WebFetchUrlSourceExcept except)
The tool filter variant under which every result but the named tools' contributes.
-
ofExcept
final static WebFetchUrlSources.ServerToolResults ofExcept(List<WebFetchUrlSourceToolReference> tools)
Returns an immutable instance of ServerToolResults whose ofExcept variant is built from the given required tools.
-
-
-
-