Docs: PreToolUse hook tool_input (Bash) omits run_in_background / description / tool_use_id
Summary
The hooks docs show the PreToolUse tool_input for a Bash tool call as only:
"tool_input": { "command": "npm test" }
The actual runtime payload also carries description and run_in_background inside tool_input, plus tool_use_id at the top level. The omission of run_in_background is the consequential one: a PreToolUse hook cannot distinguish a foreground Bash call from a backgrounded one without it, yet the documented schema implies the field isn't available — so hook authors either read an "undocumented" field or wrongly assume it's absent.
Environment
- Claude Code 2.1.195, Node v22.17.0, Windows 11.
Actual payload (raw stdin captured by a PreToolUse Bash hook)
{"session_id":"…","transcript_path":"…","cwd":"…","permission_mode":"…",
"hook_event_name":"PreToolUse","tool_name":"Bash",
"tool_input":{"command":"echo hi","description":"…","run_in_background":true},
"tool_use_id":"toolu_…"}
(timeout likewise appears inside tool_input when the Bash tool is invoked with it.)
Repro
A one-line PreToolUse Bash hook that appends stdin to a file (cat >> /tmp/probe.log) shows the fields above on any backgrounded Bash call.
Suggested fix
Document the additional tool_input fields for Bash (description, run_in_background, timeout) and the top-level tool_use_id — or note explicitly that the example tool_input is non-exhaustive and mirrors the tool's full parameter set.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗