Repository navigation
Read updatedToolOutput from hookSpecificOutput, as Claude Code does - #448
Merged
Merged
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



A PostToolUse hook that returns
updatedToolOutputunderhookSpecificOutputhad no effect: the field was read at the top level of the hook output only. Claude Code 2.1.325 reads it underhookSpecificOutputonly.Tool result the model gets for
echo hiwith a Bash PostToolUse hook that replaces the output with[redacted]:updatedToolOutputunderhookSpecificOutputhi[redacted][redacted]updatedToolOutputat the top level[redacted]hiupdatedToolOutput()inextensions/hooks/index.tsreadshookSpecificOutput.updatedToolOutput.hookSpecificOutput.updatedToolOutputwins andupdatedMCPToolOutputis read only when it is absent, the order Claude Code applies. Before,updatedMCPToolOutputwon.updatedToolOutputandupdatedMCPToolOutputare removed from the top-level output fields inextensions/hooks/decisions.ts.Breaking: a hook that returns
updatedToolOutputat the top level no longer replaces the output. Move the field underhookSpecificOutput, which also works in Claude Code.Closes #447
npm run checkpasses (Biome, strict tsc, Vitest)