Class BetaManagedAgentsMcpToolConfig.PermissionPolicy
-
- All Implemented Interfaces:
public final class BetaManagedAgentsMcpToolConfig.PermissionPolicyPermission policy for tool execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaManagedAgentsMcpToolConfig.PermissionPolicy.VisitorAn interface that defines how to map each variant of PermissionPolicy to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsAlwaysAllowPolicy>alwaysAllow()Tool calls are automatically approved without user confirmation. final Optional<BetaManagedAgentsAlwaysAskPolicy>alwaysAsk()Tool calls require user confirmation before execution. final BooleanisAlwaysAllow()final BooleanisAlwaysAsk()final BetaManagedAgentsAlwaysAllowPolicyasAlwaysAllow()Tool calls are automatically approved without user confirmation. final BetaManagedAgentsAlwaysAskPolicyasAlwaysAsk()Tool calls require user confirmation before execution. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaManagedAgentsMcpToolConfig.PermissionPolicy.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaManagedAgentsMcpToolConfig.PermissionPolicyvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaManagedAgentsMcpToolConfig.PermissionPolicyofAlwaysAllow(BetaManagedAgentsAlwaysAllowPolicy alwaysAllow)Tool calls are automatically approved without user confirmation. final static BetaManagedAgentsMcpToolConfig.PermissionPolicyofAlwaysAsk(BetaManagedAgentsAlwaysAskPolicy alwaysAsk)Tool calls require user confirmation before execution. -
-
Method Detail
-
alwaysAllow
final Optional<BetaManagedAgentsAlwaysAllowPolicy> alwaysAllow()
Tool calls are automatically approved without user confirmation.
-
alwaysAsk
final Optional<BetaManagedAgentsAlwaysAskPolicy> alwaysAsk()
Tool calls require user confirmation before execution.
-
isAlwaysAllow
final Boolean isAlwaysAllow()
-
isAlwaysAsk
final Boolean isAlwaysAsk()
-
asAlwaysAllow
final BetaManagedAgentsAlwaysAllowPolicy asAlwaysAllow()
Tool calls are automatically approved without user confirmation.
-
asAlwaysAsk
final BetaManagedAgentsAlwaysAskPolicy asAlwaysAsk()
Tool calls require user confirmation before execution.
-
accept
final <T extends Any> T accept(BetaManagedAgentsMcpToolConfig.PermissionPolicy.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 = permissionPolicy.accept(new PermissionPolicy.Visitor<Optional<String>>() { @Override public Optional<String> visitAlwaysAllow(BetaManagedAgentsAlwaysAllowPolicy alwaysAllow) { return Optional.of(alwaysAllow.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaManagedAgentsMcpToolConfig.PermissionPolicy 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.
-
ofAlwaysAllow
final static BetaManagedAgentsMcpToolConfig.PermissionPolicy ofAlwaysAllow(BetaManagedAgentsAlwaysAllowPolicy alwaysAllow)
Tool calls are automatically approved without user confirmation.
-
ofAlwaysAsk
final static BetaManagedAgentsMcpToolConfig.PermissionPolicy ofAlwaysAsk(BetaManagedAgentsAlwaysAskPolicy alwaysAsk)
Tool calls require user confirmation before execution.
-
-
-
-