Skip to content

Read updatedToolOutput from hookSpecificOutput, as Claude Code does - #448

Merged
ilovepixelart merged 1 commit into
mainfrom
fix/post-tool-updated-output
Nov 15, 2026
Merged

ilovepixelart merged 1 commit into
mainfrom
fix/post-tool-updated-output

Conversation

@ilovepixelart

Copy link
Copy Markdown
Owner

A PostToolUse hook that returns updatedToolOutput under hookSpecificOutput had no effect: the field was read at the top level of the hook output only. Claude Code 2.1.325 reads it under hookSpecificOutput only.

Tool result the model gets for echo hi with a Bash PostToolUse hook that replaces the output with [redacted]:

Hook output Before After Claude Code 2.1.325
updatedToolOutput under hookSpecificOutput hi [redacted] [redacted]
updatedToolOutput at the top level [redacted] hi original output
  • updatedToolOutput() in extensions/hooks/index.ts reads hookSpecificOutput.updatedToolOutput.
  • For an MCP tool, hookSpecificOutput.updatedToolOutput wins and updatedMCPToolOutput is read only when it is absent, the order Claude Code applies. Before, updatedMCPToolOutput won.
  • updatedToolOutput and updatedMCPToolOutput are removed from the top-level output fields in extensions/hooks/decisions.ts.

Breaking: a hook that returns updatedToolOutput at the top level no longer replaces the output. Move the field under hookSpecificOutput, which also works in Claude Code.

Closes #447

  • npm run check passes (Biome, strict tsc, Vitest)
  • Tests cover the change

A PostToolUse hook that returned updatedToolOutput under
hookSpecificOutput, the form Claude Code documents and reads, had no
effect: the model received the original output. The field was read at
the top level of the output only, where Claude Code 2.1.325 ignores it.

With a Bash hook printing
{"hookSpecificOutput":{"hookEventName":"PostToolUse","updatedToolOutput":
{"stdout":"[redacted]","stderr":"","interrupted":false,"isImage":false}}}
the model now receives "[redacted]". The same field at the top level is
ignored and the output stays as it was.

For an MCP tool updatedToolOutput now wins over updatedMCPToolOutput,
which is read only when the former is absent, the order Claude Code
applies. Both names are no longer top-level output fields, so they do
not turn a multi-line plain-text output into a parse failure.
@sonarqubecloud

Copy link
Copy Markdown

@ilovepixelart
ilovepixelart merged commit a5ff5f1 into main Nov 15, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostToolUse: updatedToolOutput under hookSpecificOutput is ignored

1 participant