Class BetaResponseToolRemovalBlock.Tool
-
- All Implemented Interfaces:
public final class BetaResponseToolRemovalBlock.ToolA reference to the withdrawn
toolsentry, MCP tool or MCP toolset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaResponseToolRemovalBlock.Tool.VisitorAn interface that defines how to map each variant of Tool to a value of type T.
public final classBetaResponseToolRemovalBlock.Tool.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaResponseToolChangeToolReference>reference()Reference to a single tool, by the name the model uses to call it, as a `compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block.final Optional<BetaResponseToolChangeMcpToolReference>mcpToolReference()Reference to a single MCP tool, by its server and its name on that server, as a `compaction`block's`tool_changes`entry reports it.final Optional<BetaResponseToolChangeMcpToolsetReference>mcpToolsetReference()Reference to every tool in the named MCP server's toolset, as a `compaction`block's`tool_changes`entry reports it.final Optional<JsonValue>_json()final BetaResponseToolRemovalBlock.Tool.Typetype()final Optional<String>name()final Optional<String>serverName()final BooleanisReference()final BooleanisMcpToolReference()final BooleanisMcpToolsetReference()final BetaResponseToolChangeToolReferenceasReference()Reference to a single tool, by the name the model uses to call it, as a `compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block.final BetaResponseToolChangeMcpToolReferenceasMcpToolReference()Reference to a single MCP tool, by its server and its name on that server, as a `compaction`block's`tool_changes`entry reports it.final BetaResponseToolChangeMcpToolsetReferenceasMcpToolsetReference()Reference to every tool in the named MCP server's toolset, as a `compaction`block's`tool_changes`entry reports it.final <T extends Any> Taccept(BetaResponseToolRemovalBlock.Tool.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaResponseToolRemovalBlock.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 BetaResponseToolRemovalBlock.ToolofReference(BetaResponseToolChangeToolReference reference)Reference to a single tool, by the name the model uses to call it, as a `compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block.final static BetaResponseToolRemovalBlock.ToolofReference(String name)Returns an immutable instance of Tool whose ofReference variant is built from the given required name. final static BetaResponseToolRemovalBlock.ToolofMcpToolReference(BetaResponseToolChangeMcpToolReference mcpToolReference)Reference to a single MCP tool, by its server and its name on that server, as a `compaction`block's`tool_changes`entry reports it.final static BetaResponseToolRemovalBlock.ToolofMcpToolsetReference(BetaResponseToolChangeMcpToolsetReference mcpToolsetReference)Reference to every tool in the named MCP server's toolset, as a `compaction`block's`tool_changes`entry reports it.final static BetaResponseToolRemovalBlock.ToolofMcpToolsetReference(String serverName)Returns an immutable instance of Tool whose ofMcpToolsetReference variant is built from the given required serverName. -
-
Method Detail
-
reference
final Optional<BetaResponseToolChangeToolReference> reference()
Reference to a single tool, by the name the model uses to call it, as a
`compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block. Send it back unchanged with the block.
-
mcpToolReference
final Optional<BetaResponseToolChangeMcpToolReference> mcpToolReference()
Reference to a single MCP tool, by its server and its name on that server, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
mcpToolsetReference
final Optional<BetaResponseToolChangeMcpToolsetReference> mcpToolsetReference()
Reference to every tool in the named MCP server's toolset, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
type
final BetaResponseToolRemovalBlock.Tool.Type type()
-
serverName
final Optional<String> serverName()
-
isReference
final Boolean isReference()
-
isMcpToolReference
final Boolean isMcpToolReference()
-
isMcpToolsetReference
final Boolean isMcpToolsetReference()
-
asReference
final BetaResponseToolChangeToolReference asReference()
Reference to a single tool, by the name the model uses to call it, as a
`compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block. Send it back unchanged with the block.
-
asMcpToolReference
final BetaResponseToolChangeMcpToolReference asMcpToolReference()
Reference to a single MCP tool, by its server and its name on that server, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
asMcpToolsetReference
final BetaResponseToolChangeMcpToolsetReference asMcpToolsetReference()
Reference to every tool in the named MCP server's toolset, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
accept
final <T extends Any> T accept(BetaResponseToolRemovalBlock.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(BetaResponseToolChangeToolReference reference) { return Optional.of(reference.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaResponseToolRemovalBlock.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 BetaResponseToolRemovalBlock.Tool ofReference(BetaResponseToolChangeToolReference reference)
Reference to a single tool, by the name the model uses to call it, as a
`compaction`block's`tool_changes`entry reports it: a tool declared in`tools`or defined by an earlier`tool_addition`block. Send it back unchanged with the block.
-
ofReference
final static BetaResponseToolRemovalBlock.Tool ofReference(String name)
Returns an immutable instance of Tool whose ofReference variant is built from the given required name.
-
ofMcpToolReference
final static BetaResponseToolRemovalBlock.Tool ofMcpToolReference(BetaResponseToolChangeMcpToolReference mcpToolReference)
Reference to a single MCP tool, by its server and its name on that server, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
ofMcpToolsetReference
final static BetaResponseToolRemovalBlock.Tool ofMcpToolsetReference(BetaResponseToolChangeMcpToolsetReference mcpToolsetReference)
Reference to every tool in the named MCP server's toolset, as a
`compaction`block's`tool_changes`entry reports it. Send it back unchanged with the block.
-
ofMcpToolsetReference
final static BetaResponseToolRemovalBlock.Tool ofMcpToolsetReference(String serverName)
Returns an immutable instance of Tool whose ofMcpToolsetReference variant is built from the given required serverName.
-
-
-
-