Problem
When context-mode blocks WebFetch via the PreToolUse hook, it instructs the agent to use ctx_fetch_and_index instead. However, if the context-mode MCP server is not running (or its tools are not yet registered in the session), the agent has no fallback and gets stuck — repeatedly retrying WebFetch and receiving the same blocking error.
Steps to Reproduce
- Install context-mode plugin and start a new Claude Code session
- Ask the agent to fetch a URL (e.g. a GitHub repo page)
- The
PreToolUse hook blocks WebFetch and tells the agent to use ctx_fetch_and_index
- If the MCP server hasn't started / tools aren't registered yet, the agent retries
WebFetch and gets blocked again repeatedly
Observed Behavior
PreToolUse:WebFetch hook returned blocking error
context-mode: WebFetch blocked. Use mcp__plugin_context-mode_context-mode__ctx_fetch_and_index(url: "...", source: "...") to fetch this URL in sandbox. Then use mcp__plugin_context-mode_context-mode__ctx_search(queries: [...]) to query results. Do NOT use curl, wget, mcp_web_fetch, or mcp_fetch_tool.
The error fires twice in a row and the agent gives up without completing the task.
Expected Behavior
Either:
- The MCP server should be guaranteed to be started and tools registered before any
WebFetch block fires, OR
- The hook's deny message should detect MCP tool unavailability and degrade gracefully (e.g. allow the fetch if
ctx_fetch_and_index is not available), OR
- The
sessionstart.mjs hook should validate that the MCP server is reachable before the session begins
Environment
- context-mode version: 1.0.59
- Platform: macOS
- Claude Code with
PreToolUse hook on matcher: Bash|WebFetch|Read|Grep|Agent|Task|...
Problem
When
context-modeblocksWebFetchvia thePreToolUsehook, it instructs the agent to usectx_fetch_and_indexinstead. However, if the context-mode MCP server is not running (or its tools are not yet registered in the session), the agent has no fallback and gets stuck — repeatedly retryingWebFetchand receiving the same blocking error.Steps to Reproduce
PreToolUsehook blocksWebFetchand tells the agent to usectx_fetch_and_indexWebFetchand gets blocked again repeatedlyObserved Behavior
The error fires twice in a row and the agent gives up without completing the task.
Expected Behavior
Either:
WebFetchblock fires, ORctx_fetch_and_indexis not available), ORsessionstart.mjshook should validate that the MCP server is reachable before the session beginsEnvironment
PreToolUsehook on matcher:Bash|WebFetch|Read|Grep|Agent|Task|...