Class BetaRequestToolRemovalBlock.Tool
-
- All Implemented Interfaces:
public final class BetaRequestToolRemovalBlock.Tool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaRequestToolRemovalBlock.Tool.VisitorAn interface that defines how to map each variant of Tool to a value of type T.
public final classBetaRequestToolRemovalBlock.Tool.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaToolChangeToolReference>reference()Reference to a single tool, by the name the model uses to call it: a tool declared in `tools`or defined by an earlier`tool_addition`block.final Optional<BetaToolChangeMcpToolReference>mcpToolReference()Reference to a single MCP tool by its server and remote name; the same `server_name`/`name`pair`mcp_tool_use`carries.final Optional<BetaToolChangeMcpToolsetReference>mcpToolsetReference()Reference to every tool in the named MCP server's toolset. final Optional<JsonValue>_json()final BetaRequestToolRemovalBlock.Tool.Typetype()final Optional<String>name()final Optional<String>serverName()final BooleanisReference()final BooleanisMcpToolReference()final BooleanisMcpToolsetReference()final BetaToolChangeToolReferenceasReference()Reference to a single tool, by the name the model uses to call it: a tool declared in `tools`or defined by an earlier`tool_addition`block.final BetaToolChangeMcpToolReferenceasMcpToolReference()Reference to a single MCP tool by its server and remote name; the same `server_name`/`name`pair`mcp_tool_use`carries.final BetaToolChangeMcpToolsetReferenceasMcpToolsetReference()Reference to every tool in the named MCP server's toolset. final <T extends Any> Taccept(BetaRequestToolRemovalBlock.Tool.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaRequestToolRemovalBlock.Toolvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaRequestToolRemovalBlock.ToolofReference(BetaToolChangeToolReference reference)Reference to a single tool, by the name the model uses to call it: a tool declared in `tools`or defined by an earlier`tool_addition`block.final static BetaRequestToolRemovalBlock.ToolofReference(String name)Returns an immutable instance of Tool whose ofReference variant is built from the given required name. final static BetaRequestToolRemovalBlock.ToolofMcpToolReference(BetaToolChangeMcpToolReference mcpToolReference)Reference to a single MCP tool by its server and remote name; the same `server_name`/`name`pair`mcp_tool_use`carries.final static BetaRequestToolRemovalBlock.ToolofMcpToolsetReference(BetaToolChangeMcpToolsetReference mcpToolsetReference)Reference to every tool in the named MCP server's toolset. final static BetaRequestToolRemovalBlock.ToolofMcpToolsetReference(String serverName)Returns an immutable instance of Tool whose ofMcpToolsetReference variant is built from the given required serverName. -
-
Method Detail
-
reference
final Optional<BetaToolChangeToolReference> reference()
Reference to a single tool, by the name the model uses to call it: a tool declared in
`tools`or defined by an earlier`tool_addition`block. Does not accept the composed`{server}_{name}`form the server assigns to MCP-resolved tools; use`mcp_tool_reference`or`mcp_toolset_reference`for those.
-
mcpToolReference
final Optional<BetaToolChangeMcpToolReference> mcpToolReference()
Reference to a single MCP tool by its server and remote name; the same
`server_name`/`name`pair`mcp_tool_use`carries.
-
mcpToolsetReference
final Optional<BetaToolChangeMcpToolsetReference> mcpToolsetReference()
Reference to every tool in the named MCP server's toolset.
-
type
final BetaRequestToolRemovalBlock.Tool.Type type()
-
serverName
final Optional<String> serverName()
-
isReference
final Boolean isReference()
-
isMcpToolReference
final Boolean isMcpToolReference()
-
isMcpToolsetReference
final Boolean isMcpToolsetReference()
-
asReference
final BetaToolChangeToolReference asReference()
Reference to a single tool, by the name the model uses to call it: a tool declared in
`tools`or defined by an earlier`tool_addition`block. Does not accept the composed`{server}_{name}`form the server assigns to MCP-resolved tools; use`mcp_tool_reference`or`mcp_toolset_reference`for those.
-
asMcpToolReference
final BetaToolChangeMcpToolReference asMcpToolReference()
Reference to a single MCP tool by its server and remote name; the same
`server_name`/`name`pair`mcp_tool_use`carries.
-
asMcpToolsetReference
final BetaToolChangeMcpToolsetReference asMcpToolsetReference()
Reference to every tool in the named MCP server's toolset.
-
accept
final <T extends Any> T accept(BetaRequestToolRemovalBlock.Tool.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 = tool.accept(new Tool.Visitor<Optional<String>>() { @Override public Optional<String> visitReference(BetaToolChangeToolReference reference) { return Optional.of(reference.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaRequestToolRemovalBlock.Tool 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.
-
ofReference
final static BetaRequestToolRemovalBlock.Tool ofReference(BetaToolChangeToolReference reference)
Reference to a single tool, by the name the model uses to call it: a tool declared in
`tools`or defined by an earlier`tool_addition`block. Does not accept the composed`{server}_{name}`form the server assigns to MCP-resolved tools; use`mcp_tool_reference`or`mcp_toolset_reference`for those.
-
ofReference
final static BetaRequestToolRemovalBlock.Tool ofReference(String name)
Returns an immutable instance of Tool whose ofReference variant is built from the given required name.
-
ofMcpToolReference
final static BetaRequestToolRemovalBlock.Tool ofMcpToolReference(BetaToolChangeMcpToolReference mcpToolReference)
Reference to a single MCP tool by its server and remote name; the same
`server_name`/`name`pair`mcp_tool_use`carries.
-
ofMcpToolsetReference
final static BetaRequestToolRemovalBlock.Tool ofMcpToolsetReference(BetaToolChangeMcpToolsetReference mcpToolsetReference)
Reference to every tool in the named MCP server's toolset.
-
ofMcpToolsetReference
final static BetaRequestToolRemovalBlock.Tool ofMcpToolsetReference(String serverName)
Returns an immutable instance of Tool whose ofMcpToolsetReference variant is built from the given required serverName.
-
-
-
-