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

  1. 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
        }
      ]
    }
  ]
}
  1. 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.

  1. Call the MCP tool (e.g., create a task via manage_container)
  1. Expected: additionalContext is injected into the conversation as context for the model
  2. 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.json and 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.shmcp__*__manage_container
  • mirror-bootstrap-prompt.shmcp__*__get_next_task
  • status-sync.shmcp__*__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.jsonsession-hooks.json

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗