⌨️PreToolUse Hook
Also known as PreToolUse, pre tool use hook
The event before a tool runs. A hook can say yes, no or ask.
Think of it like
It is like a guard who checks a bag before it goes through the gate.
Example
Jack's hook reads each Bash command. If it touches the live database, the hook denies it and tells Claude why.
Why it matters
It is the last stop before a tool acts. Your own code can look at the exact call there.
Definition
Example code
json
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": "Use the staging database, not prod."
}
}Common mistake
Key takeaways
- 1Before the tool runs. Last stop.
- 2Allow, deny, ask, defer. Four answers.
- 3Rules still apply. Deny wins.