Answer: For BeforeTool and AfterTool events, the matcher field in your settings is compared against the name of the tool being executed, and matchers support regular expressions (for example, matcher: "read_.*" matches all file reading tools). Status: Confirmed Entry: tool/gemini-cli/agents-and-automation/tool-hook-matchers Revision: 1 Digest: sha256:9a1be45359a33122 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:18:35Z Last changed: 2026-11-13T03:18:35Z Last verified: 2026-11-20T12:53:05Z Next check: 2026-11-21T12:53:05Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Matcher field | matcher | [1] | 2026-11-20 Applicable events | BeforeTool | [1] | 2026-11-20 Regex example | matcher: "read_.*" | [1] | 2026-11-20 MCP tool naming pattern | mcp__ | [1] | 2026-11-20 Sources: [1] Google. "Hooks reference". https://geminicli.com/docs/hooks/reference.md Role: primary. Accessed: 2026-11-20T12:53:05Z Quote: "the `matcher` field in your settings is compared against the name of the tool being executed" (Supports: Matcher field) Quote: "For `BeforeTool` and `AfterTool` events" (Supports: Applicable events) Quote: "`matcher: "read_.*"` matches all file reading tools" (Supports: Regex example) Quote: "Tools from MCP servers follow the naming pattern `mcp__`" (Supports: MCP tool naming pattern) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: 06d37f2f66812ee78bb46c37a112203376f0bae4d3b8b44ac79d0bda4b86a118 (captured 2026-11-13T03:18:34Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:18:35Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:53:05Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:53:05Z Last attempt: 2026-11-20T12:53:05Z Notes and limitations: Extracted automatically from a single official source (section "Matchers and tool names"). Related: https://latestn.com/tool/gemini-cli/agents-and-automation/trigger-headless-mode How do I trigger headless mode in Gemini CLI? https://latestn.com/tool/gemini-cli/agents-and-automation/trusted-folders-headless How does Gemini CLI handle trusted folders in headless or automated environments? https://latestn.com/tool/gemini-cli/agents-and-automation/unassign-inactive-assignees How does Gemini CLI automatically unassign inactive issue assignees? https://latestn.com/tool/gemini-cli/agents-and-automation/skill-discovery-tiers How does Gemini CLI discover Agent Skills and what are the discovery tiers? https://latestn.com/tool/gemini-cli/agents-and-automation/steer-research-phase How do I steer Gemini CLI's research phase during Plan Mode? https://latestn.com/tool/gemini-cli/agents-and-automation/streaming-json-event-types What event types does Gemini CLI streaming JSON output emit? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:18:35Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/agents-and-automation/tool-hook-matchers/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/tool-hook-matchers POST: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/tool-hook-matchers with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/agents-and-automation/tool-hook-matchers?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I use a matcher to filter which tools a Gemini CLI hook runs for? Revision 1, last verified 2026-11-20T12:53:05Z. https://latestn.com/tool/gemini-cli/agents-and-automation/tool-hook-matchers (accessed 2026-11-21T10:06:07Z). @misc{LatestN_tool_gemini_cli_agents_and_automation_tool_hook_matchers_r1, title = {How do I use a matcher to filter which tools a Gemini CLI hook runs for?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/agents-and-automation/tool-hook-matchers}}, note = {Revision 1; digest sha256:9a1be45359a33122; last verified 2026-11-20T12:53:05Z; accessed 2026-11-21T10:06:07Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/agents-and-automation/tool-hook-matchers