A `PreToolUse` hook denies the tool when the bearer is missing or userinfo rejects it. Deny runs before permission rules, so an allow rule does not skip this check.

Getting started, including the planned sample, is [Claude Agent SDK](/docs/agent-frameworks/claude-agent).

## What fails closed

The hook returns `permissionDecision` `deny` when the token is missing or userinfo rejects it. The tool does not run.

The hook returns `{}` when userinfo accepts the bearer. A `whoami` tool may then return that subject.

A resolved subject is not authorization. Scopes and allowed tools are a later check. The [trust-store sample](https://github.com/authdog/agents-samples/tree/main/trust-store/python) is that later check for MCP. This page stops at admission.

## Related

| Read | To learn how to |
| --- | --- |
| [Claude Agent SDK](/docs/agent-frameworks/claude-agent) | See the hook |
| [API keys and M2M for Claude Agent SDK](/docs/ai/claude-agent/api-keys-and-m2m) | Where the secret is allowed to live |
| [Authorizing tool calls for Claude Agent SDK](/docs/ai/claude-agent/authorize-tool-calls) | What happens after the subject is known |
