# PreToolUse Hook

> The event before a tool runs. A hook can say yes, no or ask.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** PreToolUse, pre tool use hook

## Think of it like

It is like a guard who checks a bag before it goes through the gate.

## Definition

PreToolUse is the hook event that fires after Claude picks a tool call and before it runs. A hook here can allow the call, deny it, ask you, or defer it. It can also change the tool's input. When hooks disagree, deny wins, then defer, then ask, then allow. Your deny and ask rules are still checked, whatever the hook says.

## Example

Jack's hook reads each Bash command. If it touches the live database, the hook denies it and tells Claude why.

## Example code

```json
{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "deny",
    "permissionDecisionReason": "Use the staging database, not prod."
  }
}
```

What a hook prints to deny a call.

## Why it matters

It is the last stop before a tool acts. Your own code can look at the exact call there.

## Common mistake

Thinking a hook's allow beats a deny rule. Deny and ask rules are checked anyway.

## Three principles

- **Before the tool runs.** Last stop.
- **Allow, deny, ask, defer.** Four answers.
- **Rules still apply.** Deny wins.

## Related terms

- [Claude Code Hook](https://learn.benibix.com/term/ai/claude-code-hook)
- [PostToolUse Hook](https://learn.benibix.com/term/ai/posttooluse-hook)
- [Permission Rule](https://learn.benibix.com/term/ai/permission-rule)

## Told apart from

- [PreToolUse vs PostToolUse](https://learn.benibix.com/compare/pretooluse-hook-vs-posttooluse-hook): People think both hooks can stop a bad tool call. Only one can. PreToolUse fires before the tool runs, so it can allow, deny or ask. PostToolUse fires after the tool has run, so the change is already made. It can only tell Claude what went wrong. Guard in the first, check and tidy in the second.
- [PreToolUse vs PermissionRequest](https://learn.benibix.com/compare/pretooluse-hook-vs-permissionrequest-hook): People think both fire before each tool call. PreToolUse does. PermissionRequest fires only when Claude Code is about to ask you. So a call your rules allow never reaches it. Use PreToolUse to check each call. Use PermissionRequest to answer the prompts you would get.

![The four answers a PreToolUse hook can give, and which one wins when hooks disagree.](https://learn.benibix.com/diagrams/pretooluse-decisions.svg)

---

Source: https://learn.benibix.com/term/ai/pretooluse-hook
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
