[DOCS] Hooks example references non-existent 'Delete' tool
Documentation Type
Incorrect/outdated documentation
Documentation Location
https://platform.claude.com/docs/en/agent-sdk/hooks
Section/Topic
"Configure hooks" section - the regex pattern matching example
Current Documentation
The Python example shows:
HookMatcher(matcher='Write|Edit|Delete', hooks=[file_security_hook]),
The TypeScript example shows:
{ matcher: 'Write|Edit|Delete', hooks: [fileSecurityHook] },
The comment describes these as "Match file modification tools".
What's Wrong or Missing?
The Delete tool does not exist in the Claude Agent SDK. The actual file modification tools available are:
Write- Create new filesEdit- Modify existing filesMultiEdit- Edit multiple files
There is no Delete tool for removing files. Users copying this example will have dead pattern matching that never triggers for the non-existent Delete tool.
SDK Evidence:
Searching the Python SDK source for "Delete" returns no results. The available tools documented in the same hooks.md file (line 199) are:
Built-in tools includeBash,Read,Write,Edit,Glob,Grep,WebFetch,Task, and others.
No Delete tool is mentioned in this list or anywhere else in the SDK.
Suggested Improvement
Remove Delete from both code examples. If the intent is to match all file modification tools:
Python:
HookMatcher(matcher='Write|Edit|MultiEdit', hooks=[file_security_hook]),
TypeScript:
{ matcher: 'Write|Edit|MultiEdit', hooks: [fileSecurityHook] },
Or simply:
HookMatcher(matcher='Write|Edit', hooks=[file_security_hook]),
If file deletion is done via Bash (e.g., rm command), update the comment to clarify that file deletion requires Bash command interception rather than a dedicated Delete tool.
Impact
Medium - Makes feature difficult to understand
Additional Context
Verification Method: Cross-referenced against Python Agent SDK source code (claude-agent-sdk-python)
SDK File: Searched entire SDK codebase - no Delete tool exists
Related Issue: This is similar to the non-existent LS tool documented in the same hooks.md file (issue-01). Both issues suggest the documentation may have been written speculatively without verifying against actual SDK capabilities.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗