PreToolUse matchers miss external MCP namespaces; raw output enters context
Current state (v1.0.103)
hooks/hooks.json PreToolUse covers: Bash, WebFetch, Read, Grep, Agent, and three mcp__plugin_context-mode_context-mode__ctx_* tools. PostToolUse matcher is broad (Bash|...|mcp__) and catches everything post-execution.
Symptom
Large MCP returns reach the agent unfiltered before PostToolUse fires. PreToolUse can't route them through ctx_execute or warn the agent first, because the matcher list doesn't include them.
Concrete examples of large unbounded returns:
mcp__slack-* channel history, conversation search (50+ messages)
mcp__plugin_telegram__* message content, attachments
mcp__claude_ai_Google_Drive__* file content, search results
- any future notion / obsidian-cli style MCP server
Proposal
Add PreToolUse matchers for external MCP namespaces. Two shapes:
- A broader pattern:
mcp__(?!plugin_context-mode_).*. Covers all external MCPs and avoids recursing into context-mode.
- A per-namespace allowlist that grows as new MCPs are added.
Option 1 scales without manual upkeep. pretooluse.mjs already runs for ctx_* calls, so the existing routing logic should apply.
Workaround
Local edit to hooks/hooks.json, lost on plugin upgrade.
Happy to PR option 1 if that's the direction you'd take.
PreToolUse matchers miss external MCP namespaces; raw output enters context
Current state (v1.0.103)
hooks/hooks.jsonPreToolUse covers: Bash, WebFetch, Read, Grep, Agent, and threemcp__plugin_context-mode_context-mode__ctx_*tools. PostToolUse matcher is broad (Bash|...|mcp__) and catches everything post-execution.Symptom
Large MCP returns reach the agent unfiltered before PostToolUse fires. PreToolUse can't route them through
ctx_executeor warn the agent first, because the matcher list doesn't include them.Concrete examples of large unbounded returns:
mcp__slack-*channel history, conversation search (50+ messages)mcp__plugin_telegram__*message content, attachmentsmcp__claude_ai_Google_Drive__*file content, search resultsProposal
Add PreToolUse matchers for external MCP namespaces. Two shapes:
mcp__(?!plugin_context-mode_).*. Covers all external MCPs and avoids recursing into context-mode.Option 1 scales without manual upkeep.
pretooluse.mjsalready runs forctx_*calls, so the existing routing logic should apply.Workaround
Local edit to
hooks/hooks.json, lost on plugin upgrade.Happy to PR option 1 if that's the direction you'd take.