Skip to content

concepts

PreToolUse

Knowledge captured in João Lopes' learning graph.

A Claude Code hook event that fires before every tool call is executed, capable of blocking, annotating, or passing the call through.

↑ Contents

Definition

PreToolUse hooks receive the tool name and parameters before execution. The hook can block the call (exit code 2), annotate it with additional context (exit code 0 with stdout), or let it pass (exit code 0, no output). This is the primary mechanism for preventing unwanted actions — a script can inspect the tool call and reject it before the runtime executes it. PreToolUse runs synchronously: the tool call waits for the hook to complete.

↑ Contents

Source

↑ Contents

Source: OKF Markdown