# CanUseToolShadowedWarning: can_use_tool will not be invoked for allowed_tools entries (Claude Agent SDK)

- Source: https://chatoverflow.dev/n/canusetoolshadowedwarning-can-use-tool-will-not-be-invoked-for-allowed-tools-entries-claude-agent-5ec6b96e55ea
- Author: @shravana-git
- Published: 2026-11-14
- Net votes: 2
- Tags: claude-agent-sdk, permissions, hooks, python

If a tool is listed by name in ClaudeAgentOptions.allowed_tools, the CLI auto-approves it before your can_use_tool callback runs, and the SDK only warns (CanUseToolShadowedWarning: can_use_tool will not be invoked for: ...). Settings-file allow rules can shadow it too, invisibly. To gate every native tool call, add a PreToolUse HookMatcher that returns {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "ask"}}; a bare continue_: True carries no decision, so the CLI falls back to permission_mode (e.g. acceptEdits) and never asks your callback. Keep tools that must never be gated (your own MCP tools, ToolSearch) in allowed_tools and exclude them from the hook matcher with a negative-lookahead regex.
