Evaluates the permission decision for a single tool call, applying all relevant rules in priority order.
Usage
check_permission(
tool_name,
mode = "default",
rules = list(),
tool_input = NULL,
allow_plan_exit = FALSE,
capability = NULL
)Arguments
- tool_name
Character(1). Name of the tool (e.g.
"Bash","Write").- mode
Character(1). One of the values in PermissionMode.
- rules
List of
PermissionRule()objects. Every matching explicit deny is absolute; declaration order is preserved only among remaining allow/ask rules.- tool_input
List or NULL. Tool arguments (used for Bash read-only detection).
- allow_plan_exit
Logical. Whether
ExitPlanModemay restore a mode after a trusted in-sessionEnterPlanModetransition.- capability
Optional character(1). The caller's resolved capability for this tool (
"read","write","exec","net"). The central gate passes what it resolved from the liveToolDef, which can see annotations a name-only lookup cannot (btw setsread_only_hinton every tool it ships). Ignored for tools listed in the built-in metadata, so a host cannot downgradeBashby passing"read".NULLresolves from the tool name.