Class BetaSystemMessageParam.Content.SystemMessageContentBlock
-
- All Implemented Interfaces:
public final class BetaSystemMessageParam.Content.SystemMessageContentBlock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaSystemMessageParam.Content.SystemMessageContentBlock.VisitorAn interface that defines how to map each variant of SystemMessageContentBlock to a value of type T.
public final classBetaSystemMessageParam.Content.SystemMessageContentBlock.Type
-
Method Summary
-
-
Method Detail
-
text
final Optional<BetaTextBlockParam> text()
-
toolAddition
final Optional<BetaRequestToolAdditionBlock> toolAddition()
Mid-conversation directive to make a tool available.
`tool`is a reference to a tool (or MCP toolset) declared in the request's`tools`. Under the`inline-tools-2026-09-15`beta it may instead be a reference to a tool defined earlier in`messages`, or a`tool_definition`object that carries an inline tool definition in`definition`(the same object a`tools`entry holds). An`mcp_toolset`definition also requires the`mcp-client-2026-09-15`beta. The tool is offered to the model from this point in the conversation onward.
-
toolRemoval
final Optional<BetaRequestToolRemovalBlock> toolRemoval()
Mid-conversation directive to withdraw a tool.
`tool`references a tool (or MCP toolset) by name: one declared in the request's`tools`or defined earlier in`messages`. It is no longer offered to the model from this point in the conversation onward.
-
cacheControl
final Optional<BetaCacheControlEphemeral> cacheControl()
-
isToolAddition
final Boolean isToolAddition()
-
isToolRemoval
final Boolean isToolRemoval()
-
asText
final BetaTextBlockParam asText()
-
asToolAddition
final BetaRequestToolAdditionBlock asToolAddition()
Mid-conversation directive to make a tool available.
`tool`is a reference to a tool (or MCP toolset) declared in the request's`tools`. Under the`inline-tools-2026-09-15`beta it may instead be a reference to a tool defined earlier in`messages`, or a`tool_definition`object that carries an inline tool definition in`definition`(the same object a`tools`entry holds). An`mcp_toolset`definition also requires the`mcp-client-2026-09-15`beta. The tool is offered to the model from this point in the conversation onward.
-
asToolRemoval
final BetaRequestToolRemovalBlock asToolRemoval()
Mid-conversation directive to withdraw a tool.
`tool`references a tool (or MCP toolset) by name: one declared in the request's`tools`or defined earlier in`messages`. It is no longer offered to the model from this point in the conversation onward.
-
accept
final <T extends Any> T accept(BetaSystemMessageParam.Content.SystemMessageContentBlock.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 = systemMessageContentBlock.accept(new SystemMessageContentBlock.Visitor<Optional<String>>() { @Override public Optional<String> visitText(BetaTextBlockParam text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaSystemMessageParam.Content.SystemMessageContentBlock 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 BetaSystemMessageParam.Content.SystemMessageContentBlock ofText(BetaTextBlockParam text)
-
ofText
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofText(String text)
Returns an immutable instance of SystemMessageContentBlock whose ofText variant is built from the given required text.
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaRequestToolAdditionBlock toolAddition)
Mid-conversation directive to make a tool available.
`tool`is a reference to a tool (or MCP toolset) declared in the request's`tools`. Under the`inline-tools-2026-09-15`beta it may instead be a reference to a tool defined earlier in`messages`, or a`tool_definition`object that carries an inline tool definition in`definition`(the same object a`tools`entry holds). An`mcp_toolset`definition also requires the`mcp-client-2026-09-15`beta. The tool is offered to the model from this point in the conversation onward.
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaRequestToolAdditionBlock.Tool tool)
Returns an immutable instance of SystemMessageContentBlock whose ofToolAddition variant is built from the given required tool.
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaToolChangeToolReference reference)
Alias for calling ofToolAddition with
BetaRequestToolAdditionBlock.Tool.ofReference(reference).
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaResponseToolChangeToolReference reference)
Alias for calling ofToolAddition with
reference.toParam().
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaToolChangeMcpToolReference mcpToolReference)
Alias for calling ofToolAddition with
BetaRequestToolAdditionBlock.Tool.ofMcpToolReference(mcpToolReference).
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaResponseToolChangeMcpToolReference mcpToolReference)
Alias for calling ofToolAddition with
mcpToolReference.toParam().
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaToolChangeMcpToolsetReference mcpToolsetReference)
Alias for calling ofToolAddition with
BetaRequestToolAdditionBlock.Tool.ofMcpToolsetReference(mcpToolsetReference).
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaResponseToolChangeMcpToolsetReference mcpToolsetReference)
Alias for calling ofToolAddition with
mcpToolsetReference.toParam().
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaToolChangeToolDefinitionParam definition)
Alias for calling ofToolAddition with
BetaRequestToolAdditionBlock.Tool.ofDefinition(definition).
-
ofToolAddition
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolAddition(BetaToolChangeToolDefinition definition)
Alias for calling ofToolAddition with
definition.toParam().
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaRequestToolRemovalBlock toolRemoval)
Mid-conversation directive to withdraw a tool.
`tool`references a tool (or MCP toolset) by name: one declared in the request's`tools`or defined earlier in`messages`. It is no longer offered to the model from this point in the conversation onward.
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaRequestToolRemovalBlock.Tool tool)
Returns an immutable instance of SystemMessageContentBlock whose ofToolRemoval variant is built from the given required tool.
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaToolChangeToolReference reference)
Alias for calling ofToolRemoval with
BetaRequestToolRemovalBlock.Tool.ofReference(reference).
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaResponseToolChangeToolReference reference)
Alias for calling ofToolRemoval with
reference.toParam().
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaToolChangeMcpToolReference mcpToolReference)
Alias for calling ofToolRemoval with
BetaRequestToolRemovalBlock.Tool.ofMcpToolReference(mcpToolReference).
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaResponseToolChangeMcpToolReference mcpToolReference)
Alias for calling ofToolRemoval with
mcpToolReference.toParam().
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaToolChangeMcpToolsetReference mcpToolsetReference)
Alias for calling ofToolRemoval with
BetaRequestToolRemovalBlock.Tool.ofMcpToolsetReference(mcpToolsetReference).
-
ofToolRemoval
final static BetaSystemMessageParam.Content.SystemMessageContentBlock ofToolRemoval(BetaResponseToolChangeMcpToolsetReference mcpToolsetReference)
Alias for calling ofToolRemoval with
mcpToolsetReference.toParam().
-
-
-
-