Skip to content

Instantly share code, notes, and snippets.

@FrancisBourre
Created August 25, 2025 02:06
Show Gist options
  • Select an option

  • Save FrancisBourre/5d9fc7f6247b2a717afccc5f4555dd30 to your computer and use it in GitHub Desktop.

Select an option

Save FrancisBourre/5d9fc7f6247b2a717afccc5f4555dd30 to your computer and use it in GitHub Desktop.
title description category tags last_updated difficulty estimated_time author status audience prerequisites related_docs
Claude Code Tools by Hook Event Type
Comprehensive mapping of Claude Code tools to their interceptable hook events, organized by hook type for quick reference
reference
claude-code
hooks
tools
permissions
pretooluse
posttooluse
mcp-tools
automation
2025-01-18
intermediate
15 minutes
Claude Code Team
published
developers
system-administrators
security-engineers
claude-code-basics
hooks-fundamentals
claude-code-hooks-schemas.md
claude-code-hooks-guide.md
claude-code-settings.md

Claude Code Tools by Hook Event Type

This document maps every official Claude Code tool to the hook events that can intercept or observe them. It's organized by hook type so you can quickly see which tools will trigger each hook.

Source of truth for the tool list: Settings → Tools available to Claude.
Hooks behavior and matchers: Hooks reference.

Table of Contents

  1. PreToolUse — Tools intercepted before execution
  2. PostToolUse — Tools observed after success
  3. Notification — Tools that emit permission prompts
  4. SubagentStop — Tools that end subagents
  5. Hooks that don't target tools
  6. Notes on MCP tools & matching
  7. Appendix: Full tool roster & permissions

PreToolUse — Tools intercepted before execution

PreToolUse runs after Claude forms the tool parameters but before the tool is executed.
It can block, ask, or allow a call via hook output, and supports tool-name matchers.

Interceptable tools:

  • Bash
  • Edit
  • Glob
  • Grep
  • LS
  • MultiEdit
  • NotebookEdit
  • NotebookRead
  • Read
  • Task
  • TodoWrite
  • WebFetch
  • WebSearch
  • Write

Also matches any MCP-provided tool (see Notes).


PostToolUse — Tools observed after success

PostToolUse fires immediately after a tool completes successfully.
It receives the tool’s input and output to validate, log, or provide feedback to Claude.

Observable tools: (same coverage as PreToolUse)

  • Bash
  • Edit
  • Glob
  • Grep
  • LS
  • MultiEdit
  • NotebookEdit
  • NotebookRead
  • Read
  • Task
  • TodoWrite
  • WebFetch
  • WebSearch
  • Write

Also matches any MCP-provided tool (see Notes).


Notification — Tools that emit permission prompts

Notification hooks run when Claude Code needs your permission to use a tool (and on some idle cases).
These tools are marked Permission Required = Yes in the official table and therefore can trigger a permission Notification on first use or when rules require it:

  • Bash — Yes
  • Edit — Yes
  • MultiEdit — Yes
  • NotebookEdit — Yes
  • WebFetch — Yes
  • WebSearch — Yes
  • Write — Yes

Tools with Permission Required = No (e.g., Read, LS, Grep, Glob, NotebookRead, Task, TodoWrite) generally do not prompt for permission by default, though your permissions rules can still force confirmations.


SubagentStop — Tools that end subagents

SubagentStop runs when a sub-agent finishes. Today, subagents are created via:

  • TaskRuns a sub-agent to handle complex, multi‑step tasks.

When that subagent completes, SubagentStop fires (independent of any Pre/PostToolUse hooks around the Task call).


Hooks that don’t target tools

The following hooks do not match tool names and therefore don’t have a tool list:

  • UserPromptSubmit — Fires when the user submits a prompt (pre‑processing).
  • Stop — Fires when the main agent finishes its reply (not user‑interrupt).
  • PreCompact — Fires right before conversation compaction (manual / auto).
  • SessionStart — Fires at session start or resume.

Notes on MCP tools & matching

  • MCP tools appear with the naming pattern: mcp__<server>__<tool> (e.g., mcp__filesystem__read_file, mcp__github__search_repositories).
  • PreToolUse/PostToolUse support matcher patterns: exact names (Write), regex (Edit|Write|Notebook.*), or wildcard (*).
  • To target MCP tools, match their mcp__… names (e.g., mcp__.*__write.* to catch writes from any MCP server).

Appendix: Full tool roster & permissions

Tool Description Permission Required
Bash Executes shell commands in your environment Yes
Edit Makes targeted edits to specific files Yes
Glob Finds files based on pattern matching No
Grep Searches for patterns in file contents No
LS Lists files and directories No
MultiEdit Performs multiple edits on a single file atomically Yes
NotebookEdit Modifies Jupyter notebook cells Yes
NotebookRead Reads and displays Jupyter notebook contents No
Read Reads the contents of files No
Task Runs a sub-agent to handle complex multi-step tasks No
TodoWrite Creates and manages structured task lists No
WebFetch Fetches content from a specified URL Yes
WebSearch Performs web searches with domain filtering Yes
Write Creates or overwrites files Yes

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment