`wrap_tool_call` returns an error tool message and does not call the handler when the bearer is missing or userinfo rejects it.

Getting started, including the planned sample, is [LangChain](/docs/agent-frameworks/langchain).

## What fails closed

A tool call with no token returns a tool message `unauthorized` and does not call the handler.

A tool call with a bearer userinfo accepts calls the handler. `whoami` returns 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 |
| --- | --- |
| [LangChain](/docs/agent-frameworks/langchain) | See the hook |
| [API keys and M2M for LangChain](/docs/ai/langchain/api-keys-and-m2m) | Where the secret is allowed to live |
| [Authorizing tool calls for LangChain](/docs/ai/langchain/authorize-tool-calls) | What happens after the subject is known |
