Dynamic tool discovery
The Model Context Protocol (MCP) is a standard that lets agents discover and use tools from centralized servers without hardcoded integrations. Instead of manually adding each tool, an agent queries an MCP server that acts as a live catalog — tools can be added, updated, or removed centrally, and the agent always uses the latest versions.
Key concept · Why MCP matters
- Dynamic discovery — "integrate once" instead of re-integrating each API change.
- Interoperability — works across different LLMs; swap models without reworking integrations.
- Standardized security — one consistent auth method across many servers.
- Scalability, modularity, maintainability — tool management shifts from the agent to a dedicated service; agents stay simple and delegate.
Server, client, agent
MCP tool discovery runs on a three-part pipeline.
| Role | What it does |
|---|---|
| MCP server | Hosts the tools — functions exposed with the @mcp.tool decorator; a live catalog of capabilities. |
| MCP client | Connects to the server, fetches available tools dynamically, and generates function wrappers. |
| Azure AI agent | Receives the tool definitions and delegates to the right tool based on the user's request. |
This is especially valuable when tools evolve fast, many teams manage different APIs, and agents must act on external systems securely — the agent adapts to changing capabilities in real time.
The MCPTool and its approval flow
Azure AI Agent Service connects to a remote MCP server through an MCPTool object — no manual client sessions or function wrapping. The tools are invoked automatically during agent runs.
Key concept · Configuring and approving
An MCPTool takes a server_label, a server_url, optional allowed_tools (a whitelist), and require_approval; add auth via custom headers. Approval policy: "always" (default — a developer approves each call) or "never". When approval is required, the agent returns an mcp_approval_request (with a request ID); you reply with an mcp_approval_response (matching id + approve true/false). Connect multiple servers by adding several MCPTool objects; the agent picks the right tool per task.
Chapter 9 quiz
Thirteen questions on MCP, dynamic discovery, the architecture, and the MCPTool approval flow. Answer first, then expand Show answer.
Part A · Multiple choice
What does MCP primarily enable for agents?
- A Faster token generation
- B Dynamic discovery and use of tools from centralized servers without hardcoded integrations
- C Model fine-tuning
- D Image generation
Show answer
B. An "integrate once" model where a server is a live tool catalog.
In the MCP pipeline, what hosts the tools?
- A The MCP client
- B The MCP server
- C The agent
- D The LLM
Show answer
B — the MCP server. Tools are exposed with the @mcp.tool decorator.
What role does the MCP client play?
- A Hosts tools
- B Connects to the server, fetches tools, and generates function wrappers
- C Runs the LLM
- D Stores conversation state
Show answer
B. It bridges the server's catalog to the agent.
Which object connects an Azure AI agent to a remote MCP server?
- A FunctionTool
- B MCPTool
- C OpenApiTool
- D AzureFunctionTool
Show answer
B — MCPTool. No manual client session or function wrapping required.
What is the default value of require_approval?
- A "never"
- B "always" — a developer approves each tool call
- C "auto"
- D There is no default
Show answer
B — "always". You can set "never" to skip approval.
What does allowed_tools do on an MCPTool?
- A Whitelists specific tools the agent may access
- B Sets the model
- C Defines the temperature
- D Stores the conversation
Show answer
A. An optional whitelist restricting which server tools are available.
Part B · True or false
With MCP, tools can be updated centrally without changing agent code.
Show answer
True. Agents always get the latest tool versions from the server.
MCP works only with a single specific LLM.
Show answer
False. Interoperability across LLMs is a core advantage.
An agent can connect to multiple MCP servers at once.
Show answer
True. Add several MCPTool objects; the agent selects the right tool per task.
When approval is required, you respond with an mcp_approval_response matching the request ID.
Show answer
True. With an approve boolean.
Part C · Short answer
Name the three roles in the MCP pipeline.
Show answer
MCP server (hosts tools), MCP client (discovers/wraps), and the Azure AI agent (consumes).
Name the two required MCPTool parameters.
Show answer
server_label and server_url (optionally allowed_tools and require_approval).
Give three benefits of dynamic tool discovery with MCP.
Show answer
Any three: scalability, modularity, maintainability, flexibility, and real-time adaptation.