The tool reads the token from RunContext. require_auth on your API is the gate. Pydantic AI does not verify the bearer itself.
Getting started, including the planned sample, is Pydantic AI.
What fails closed
GET /whoami with no token is 401. The helper, given an empty token, does not return a subject.
The same call with a bearer userinfo accepts returns {"subject":"<id>"}. The tool result is that string.
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 |
|---|---|
| Pydantic AI | See the hook |
| API keys and M2M for Pydantic AI | Where the secret is allowed to live |
| Authorizing tool calls for Pydantic AI | What happens after the subject is known |