Class AgentUpdateParams.Tool
-
- All Implemented Interfaces:
public final class AgentUpdateParams.ToolUnion type for tool configurations in the tools array.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceAgentUpdateParams.Tool.VisitorAn interface that defines how to map each variant of Tool to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsAgentToolset20260401Params>agentToolset20260401()Configuration for built-in agent tools. final Optional<BetaManagedAgentsMcpToolsetParams>mcpToolset()Configuration for tools from an MCP server defined in mcp_servers.final Optional<BetaManagedAgentsCustomToolParams>custom()A custom tool that is executed by the API client rather than the agent. final BooleanisAgentToolset20260401()final BooleanisMcpToolset()final BooleanisCustom()final BetaManagedAgentsAgentToolset20260401ParamsasAgentToolset20260401()Configuration for built-in agent tools. final BetaManagedAgentsMcpToolsetParamsasMcpToolset()Configuration for tools from an MCP server defined in mcp_servers.final BetaManagedAgentsCustomToolParamsasCustom()A custom tool that is executed by the API client rather than the agent. final Optional<JsonValue>_json()final <T extends Any> Taccept(AgentUpdateParams.Tool.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final AgentUpdateParams.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 AgentUpdateParams.ToolofAgentToolset20260401(BetaManagedAgentsAgentToolset20260401Params agentToolset20260401)Configuration for built-in agent tools. final static AgentUpdateParams.ToolofMcpToolset(BetaManagedAgentsMcpToolsetParams mcpToolset)Configuration for tools from an MCP server defined in mcp_servers.final static AgentUpdateParams.ToolofCustom(BetaManagedAgentsCustomToolParams custom)A custom tool that is executed by the API client rather than the agent. -
-
Method Detail
-
agentToolset20260401
final Optional<BetaManagedAgentsAgentToolset20260401Params> agentToolset20260401()
Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.
-
mcpToolset
final Optional<BetaManagedAgentsMcpToolsetParams> mcpToolset()
Configuration for tools from an MCP server defined in
mcp_servers.
-
custom
final Optional<BetaManagedAgentsCustomToolParams> custom()
A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an
agent.custom_tool_useevent is emitted and the session goes idle, waiting for the client to provide the result via auser.custom_tool_resultevent.
-
isAgentToolset20260401
final Boolean isAgentToolset20260401()
-
isMcpToolset
final Boolean isMcpToolset()
-
asAgentToolset20260401
final BetaManagedAgentsAgentToolset20260401Params asAgentToolset20260401()
Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.
-
asMcpToolset
final BetaManagedAgentsMcpToolsetParams asMcpToolset()
Configuration for tools from an MCP server defined in
mcp_servers.
-
asCustom
final BetaManagedAgentsCustomToolParams asCustom()
A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an
agent.custom_tool_useevent is emitted and the session goes idle, waiting for the client to provide the result via auser.custom_tool_resultevent.
-
accept
final <T extends Any> T accept(AgentUpdateParams.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> visitAgentToolset20260401(BetaManagedAgentsAgentToolset20260401Params agentToolset20260401) { return Optional.of(agentToolset20260401.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final AgentUpdateParams.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.
-
ofAgentToolset20260401
final static AgentUpdateParams.Tool ofAgentToolset20260401(BetaManagedAgentsAgentToolset20260401Params agentToolset20260401)
Configuration for built-in agent tools. Use this to enable or disable groups of tools available to the agent.
-
ofMcpToolset
final static AgentUpdateParams.Tool ofMcpToolset(BetaManagedAgentsMcpToolsetParams mcpToolset)
Configuration for tools from an MCP server defined in
mcp_servers.
-
ofCustom
final static AgentUpdateParams.Tool ofCustom(BetaManagedAgentsCustomToolParams custom)
A custom tool that is executed by the API client rather than the agent. When the agent calls this tool, an
agent.custom_tool_useevent is emitted and the session goes idle, waiting for the client to provide the result via auser.custom_tool_resultevent.
-
-
-
-