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.
public final classBetaManagedAgentsMcpToolConfig.PermissionPolicy.Type
-
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 Optional<BetaManagedAgentsAutoPolicy>auto()The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. final Optional<JsonValue>_json()final BetaManagedAgentsMcpToolConfig.PermissionPolicy.Typetype()final BooleanisAlwaysAllow()final BooleanisAlwaysAsk()final BooleanisAuto()final BetaManagedAgentsAlwaysAllowPolicyasAlwaysAllow()Tool calls are automatically approved without user confirmation. final BetaManagedAgentsAlwaysAskPolicyasAlwaysAsk()Tool calls require user confirmation before execution. final BetaManagedAgentsAutoPolicyasAuto()The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. 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. final static BetaManagedAgentsMcpToolConfig.PermissionPolicyofAuto(BetaManagedAgentsAutoPolicy auto)The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. -
-
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.
-
auto
final Optional<BetaManagedAgentsAutoPolicy> auto()
The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
-
type
final BetaManagedAgentsMcpToolConfig.PermissionPolicy.Type type()
-
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.
-
asAuto
final BetaManagedAgentsAutoPolicy asAuto()
The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
-
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.
-
ofAuto
final static BetaManagedAgentsMcpToolConfig.PermissionPolicy ofAuto(BetaManagedAgentsAutoPolicy auto)
The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask, or for some causes to deny, for example when the organization is out of credits or has reached a spend limit.
-
-
-
-