BeforeToolCallEvent sets cancel_tool when the bearer is missing or userinfo rejects it. The tool runs only when the hook leaves cancel_tool unset.
Getting started, including the planned sample, is Strands Agents.
What fails closed
A before-tool event with no token sets cancel_tool to unauthorized. The tool does not run.
A before-tool event with a bearer userinfo accepts leaves cancel_tool unset and stores the subject. whoami returns it.
A resolved subject is not authorization. Scopes and allowed tools are a later check. The trust-store sample is that later check for MCP. This page stops at admission.
Related
| Read | To learn how to |
|---|---|
| Strands Agents | See the hook |
| API keys and M2M for Strands Agents | Where the secret is allowed to live |
| Authorizing tool calls for Strands Agents | What happens after the subject is known |