Class ToolResultBlockParam.Content.Block
-
- All Implemented Interfaces:
public final class ToolResultBlockParam.Content.Block
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceToolResultBlockParam.Content.Block.VisitorAn interface that defines how to map each variant of Block to a value of type T.
public final classToolResultBlockParam.Content.Block.Type
-
Method Summary
Modifier and Type Method Description final Optional<TextBlockParam>text()final Optional<ImageBlockParam>image()final Optional<SearchResultBlockParam>searchResult()final Optional<DocumentBlockParam>document()final Optional<ToolReferenceBlockParam>toolReference()Tool reference block that can be included in tool_result content. final Optional<BrowserStateBlockParam>browserState()The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final Optional<JsonValue>_json()final ToolResultBlockParam.Content.Block.Typetype()final Optional<CacheControlEphemeral>cacheControl()final Optional<String>title()final BooleanisText()final BooleanisImage()final BooleanisSearchResult()final BooleanisDocument()final BooleanisToolReference()final BooleanisBrowserState()final TextBlockParamasText()final ImageBlockParamasImage()final SearchResultBlockParamasSearchResult()final DocumentBlockParamasDocument()final ToolReferenceBlockParamasToolReference()Tool reference block that can be included in tool_result content. final BrowserStateBlockParamasBrowserState()The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final <T extends Any> Taccept(ToolResultBlockParam.Content.Block.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ToolResultBlockParam.Content.Blockvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ToolResultBlockParam.Content.BlockofText(TextBlockParam text)final static ToolResultBlockParam.Content.BlockofText(String text)Returns an immutable instance of Block whose ofText variant is built from the given required text. final static ToolResultBlockParam.Content.BlockofImage(ImageBlockParam image)final static ToolResultBlockParam.Content.BlockofImage(ImageBlockParam.Source source)Returns an immutable instance of Block whose ofImage variant is built from the given required source. final static ToolResultBlockParam.Content.BlockofImage(Base64ImageSource base64)Alias for calling ofImage with ImageBlockParam.Source.ofBase64(base64).final static ToolResultBlockParam.Content.BlockofImage(UrlImageSource url)Alias for calling ofImage with ImageBlockParam.Source.ofUrl(url).final static ToolResultBlockParam.Content.BlockofImage(FileImageSource file)Alias for calling ofImage with ImageBlockParam.Source.ofFile(file).final static ToolResultBlockParam.Content.BlockofSearchResult(SearchResultBlockParam searchResult)final static ToolResultBlockParam.Content.BlockofDocument(DocumentBlockParam document)final static ToolResultBlockParam.Content.BlockofDocument(DocumentBlockParam.Source source)Returns an immutable instance of Block whose ofDocument variant is built from the given required source. final static ToolResultBlockParam.Content.BlockofDocument(Base64PdfSource base64)Alias for calling ofDocument with DocumentBlockParam.Source.ofBase64(base64).final static ToolResultBlockParam.Content.BlockofDocument(PlainTextSource text)Alias for calling ofDocument with DocumentBlockParam.Source.ofText(text).final static ToolResultBlockParam.Content.BlockofDocument(ContentBlockSource content)Alias for calling ofDocument with DocumentBlockParam.Source.ofContent(content).final static ToolResultBlockParam.Content.BlockofDocument(UrlPdfSource url)Alias for calling ofDocument with DocumentBlockParam.Source.ofUrl(url).final static ToolResultBlockParam.Content.BlockofDocument(FileDocumentSource file)Alias for calling ofDocument with DocumentBlockParam.Source.ofFile(file).final static ToolResultBlockParam.Content.BlockofToolReference(ToolReferenceBlockParam toolReference)Tool reference block that can be included in tool_result content. final static ToolResultBlockParam.Content.BlockofToolReference(String toolName)Returns an immutable instance of Block whose ofToolReference variant is built from the given required toolName. final static ToolResultBlockParam.Content.BlockofBrowserState(BrowserStateBlockParam browserState)The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced. final static ToolResultBlockParam.Content.BlockofBrowserState(List<BrowserStateTabEntry> tabs)Returns an immutable instance of Block whose ofBrowserState variant is built from the given required tabs. -
-
Method Detail
-
text
final Optional<TextBlockParam> text()
-
image
final Optional<ImageBlockParam> image()
-
searchResult
final Optional<SearchResultBlockParam> searchResult()
-
document
final Optional<DocumentBlockParam> document()
-
toolReference
final Optional<ToolReferenceBlockParam> toolReference()
Tool reference block that can be included in tool_result content.
-
browserState
final Optional<BrowserStateBlockParam> browserState()
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
type
final ToolResultBlockParam.Content.Block.Type type()
-
cacheControl
final Optional<CacheControlEphemeral> cacheControl()
-
isSearchResult
final Boolean isSearchResult()
-
isDocument
final Boolean isDocument()
-
isToolReference
final Boolean isToolReference()
-
isBrowserState
final Boolean isBrowserState()
-
asText
final TextBlockParam asText()
-
asImage
final ImageBlockParam asImage()
-
asSearchResult
final SearchResultBlockParam asSearchResult()
-
asDocument
final DocumentBlockParam asDocument()
-
asToolReference
final ToolReferenceBlockParam asToolReference()
Tool reference block that can be included in tool_result content.
-
asBrowserState
final BrowserStateBlockParam asBrowserState()
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
accept
final <T extends Any> T accept(ToolResultBlockParam.Content.Block.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 = block.accept(new Block.Visitor<Optional<String>>() { @Override public Optional<String> visitText(TextBlockParam text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ToolResultBlockParam.Content.Block 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.
-
ofText
final static ToolResultBlockParam.Content.Block ofText(TextBlockParam text)
-
ofText
final static ToolResultBlockParam.Content.Block ofText(String text)
-
ofImage
final static ToolResultBlockParam.Content.Block ofImage(ImageBlockParam image)
-
ofImage
final static ToolResultBlockParam.Content.Block ofImage(ImageBlockParam.Source source)
Returns an immutable instance of Block whose ofImage variant is built from the given required source.
-
ofImage
final static ToolResultBlockParam.Content.Block ofImage(Base64ImageSource base64)
Alias for calling ofImage with
ImageBlockParam.Source.ofBase64(base64).
-
ofImage
final static ToolResultBlockParam.Content.Block ofImage(UrlImageSource url)
Alias for calling ofImage with
ImageBlockParam.Source.ofUrl(url).
-
ofImage
final static ToolResultBlockParam.Content.Block ofImage(FileImageSource file)
Alias for calling ofImage with
ImageBlockParam.Source.ofFile(file).
-
ofSearchResult
final static ToolResultBlockParam.Content.Block ofSearchResult(SearchResultBlockParam searchResult)
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(DocumentBlockParam document)
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(DocumentBlockParam.Source source)
Returns an immutable instance of Block whose ofDocument variant is built from the given required source.
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(Base64PdfSource base64)
Alias for calling ofDocument with
DocumentBlockParam.Source.ofBase64(base64).
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(PlainTextSource text)
Alias for calling ofDocument with
DocumentBlockParam.Source.ofText(text).
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(ContentBlockSource content)
Alias for calling ofDocument with
DocumentBlockParam.Source.ofContent(content).
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(UrlPdfSource url)
Alias for calling ofDocument with
DocumentBlockParam.Source.ofUrl(url).
-
ofDocument
final static ToolResultBlockParam.Content.Block ofDocument(FileDocumentSource file)
Alias for calling ofDocument with
DocumentBlockParam.Source.ofFile(file).
-
ofToolReference
final static ToolResultBlockParam.Content.Block ofToolReference(ToolReferenceBlockParam toolReference)
Tool reference block that can be included in tool_result content.
-
ofToolReference
final static ToolResultBlockParam.Content.Block ofToolReference(String toolName)
Returns an immutable instance of Block whose ofToolReference variant is built from the given required toolName.
-
ofBrowserState
final static ToolResultBlockParam.Content.Block ofBrowserState(BrowserStateBlockParam browserState)
The caller's browser state after a browser toolset member call — the full inventory of open tabs, which tab is active, and any side effects (tabs opened, download state changes) the call produced.
At most one per
tool_result, only on a non-error result answering a browser toolset membertool_use. The server renders the model-visible text from it; the model never sees the raw fields.
-
ofBrowserState
final static ToolResultBlockParam.Content.Block ofBrowserState(List<BrowserStateTabEntry> tabs)
Returns an immutable instance of Block whose ofBrowserState variant is built from the given required tabs.
-
-
-
-