PreToolUse hooks: allow modifying tool_input parameters
Problem
PreToolUse hooks can currently only allow, deny, ask, or defer a tool call. They cannot modify the tool call's parameters before execution.
Use Case
I use the Agent tool heavily (20+ specialized agents) and track all runs via a telemetry dashboard. When agents are spawned without a name parameter, they show up as hex session IDs in the dashboard, making it unreadable.
I wrote a PreToolUse hook that blocks unnamed Agent calls and returns a denial reason telling Claude to retry with a name. This works, but it's a clunky block-and-retry pattern that adds ~2 seconds and an extra round trip every time.
Proposed Solution
Allow PreToolUse hooks to return modified tool_input in their response, e.g.:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"modifiedToolInput": {
"name": "auto-generated-name",
"...rest of original params"
}
}
}
This would let hooks:
- Auto-name agents from the
descriptionfield (my use case) - Inject default parameters into tool calls
- Normalize inputs (e.g., expand relative paths to absolute)
- Add context (e.g., inject project-specific flags)
Current Workaround
A PreToolUse hook that denies unnamed Agent calls with a reason message. Claude sees the denial, retries with a name. Works but inefficient.
Impact
Anyone building agent orchestration or enforcing tool call conventions would benefit. The pattern of "validate and fix" is more useful than "validate and reject" for most hook use cases.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗