PostToolUse hooks with additionalContext not surfacing for MCP tool calls
Resolved 💬 10 comments Opened Feb 10, 2026 by jpicklyk Closed Jun 1, 2026
Description
PostToolUse hooks that output JSON with additionalContext and exit 0 produce no visible output when triggered by MCP tool calls. The hook scripts work correctly when tested manually (piping JSON stdin and checking stdout), but no additionalContext is injected into the conversation after MCP tool execution.
Reproduction
- Register a PostToolUse hook matching an MCP tool:
{
"PostToolUse": [
{
"matcher": "mcp__mcp-task-orchestrator__manage_container",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR\"/scripts/test-hook.sh",
"timeout": 5
}
]
}
]
}
- Hook script outputs valid JSON:
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "New MCP task created: [abcd1234] My Task. Create a CC mirror task..."
}
}
Script exits with code 0.
- Call the MCP tool (e.g., create a task via
manage_container)
- Expected:
additionalContextis injected into the conversation as context for the model - Actual: No hook output appears. Tool result shows only the MCP server response.
Verification
- Script tested manually with
echo '<json>' | bash script.sh— produces correct JSON output, exits 0 - Tested with hooks registered both via plugin
session-hooks.jsonand directly in.claude/settings.local.json - Tested across session restarts (hooks load fresh at startup)
- TaskCompleted hooks DO work using stderr + exit 2 pattern on the same MCP tool results — confirming hook matching/registration is functional
Affected hook types
All PostToolUse hooks matching MCP tools with additionalContext output:
create-mirror-prompt.sh→mcp__*__manage_containermirror-bootstrap-prompt.sh→mcp__*__get_next_taskstatus-sync.sh→mcp__*__request_transition
Environment
- Claude Code CLI (latest)
- Windows (MSYS_NT / Git Bash)
- MCP server running via Docker (stdio transport)
- Plugin hooks registered via
.claude-plugin/plugin.json→session-hooks.json
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗