Prerequisites
- A toolbox with at least one tool and a default version.
- A Microsoft Foundry project with a deployed model.
- A hosted-agent project. To create the agent and toolbox together, complete the toolbox quickstart.
- A development identity that can access the Foundry project. Sign in locally with
az loginorazd auth loginbefore you run a sample. - Any permissions required by the services behind the toolbox tools. For tools that use OAuth or Microsoft Entra identity passthrough, review Toolbox authentication before you deploy the agent.
Choose the toolbox endpoint
Use the toolbox consumer endpoint for an agent that should follow the toolbox’sdefault_version:
Authenticate the agent to the toolbox
The agent authenticates to the toolbox endpoint with its Microsoft Entra identity and thehttps://ai.azure.com/.default scope. The connection for each toolbox tool determines which identity or credential reaches the downstream service.
Don’t put downstream API keys or OAuth tokens in the agent code. Configure those credentials on the project connection that the toolbox tool references. For details about supported authentication types, consent, and role requirements, see Toolbox authentication.
Connect the hosted agent
Enforce tool approval
Each entry returned by MCPtools/list can contain a _meta.tool_configuration.require_approval value:
The toolbox MCP endpoint doesn’t block
tools/call when require_approval is always. Your agent runtime must enforce the setting before every invocation. A system-prompt instruction alone doesn’t enforce approval.
Use require_approval: never unless your runtime can pause the pending tool call, collect the user’s decision, and resume or reject that exact call. To configure the value on a toolbox tool, see Configure tool approval.