Skip to content

fix(protect-mcp): use current hook schema (hooks array) #503

Merged
wshobson merged 1 commit intowshobson:mainfrom
DiyRex:patch-1
Apr 26, 2026
Merged

fix(protect-mcp): use current hook schema (hooks array) #503
wshobson merged 1 commit intowshobson:mainfrom
DiyRex:patch-1

Conversation

@DiyRex
Copy link
Copy Markdown
Contributor

@DiyRex DiyRex commented Apr 23, 2026

The protect-mcp hooks.json uses an outdated schema with "hook": {...} (singular object). Current Claude Code expects "hooks": [...] (array of hook objects) inside each matcher.

On load, Claude Code reports:
protect-mcp@claude-code-workflows [protect-mcp]: Hook load failed:
path: hooks.PreToolUse.0.hooks — expected array, received undefined
path: hooks.PostToolUse.0.hooks — expected array, received undefined

This PR renames hookhooks and wraps each command object in an array,
matching the schema used by other plugins in this marketplace (e.g. block-no-verify).

@wshobson
Copy link
Copy Markdown
Owner

Verified against the current hooks schema in the official docs — the array form is correct, and this fixes a real load failure. Merging. Thanks!

@wshobson wshobson merged commit 1baffaa into wshobson:main Apr 26, 2026
tomjwxf added a commit to tomjwxf/wshobson-agents that referenced this pull request Apr 26, 2026
Migrates plugins/review-agent-governance/hooks/hooks.json from the
deprecated singular "hook": {...} shape to the current
"hooks": [{...}] array shape, matching the schema fix that landed
in wshobson#503 for plugins/protect-mcp/hooks/hooks.json.

Same conversion applied to both PreToolUse and PostToolUse blocks:

  Before: { "matcher": ".*", "hook": {"type": "command", ...} }
  After:  { "matcher": ".*", "hooks": [{"type": "command", ...}] }

Verified the resulting structure matches the post-wshobson#503 shape used by
plugins/protect-mcp/hooks/hooks.json byte-for-byte at the schema level.
Without this fix, current Claude Code reports
"path: hooks.PreToolUse.0.hooks - expected array, received undefined"
on plugin load.
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.

2 participants