Language capabilities as MCP tools
The Model Context Protocol (MCP) is an open protocol for how agents interact with external tools and services, built from a host (the app running the agent), a client (manages connections), and a server (exposes tools). Its advantage is dynamic tool discovery: the agent queries the server at runtime, so tools can be added or changed without touching the agent.
Key concept · What the Language MCP server exposes
Four text-analysis tools: Language Detection (identify the language), Named Entity Recognition (people, places, organizations, dates, quantities), PII Redaction (detect and mask personal details), and Text Analytics for Health (extract medical entities — diagnoses, medications, symptoms — from clinical text). The endpoint follows https://{resource}.cognitiveservices.azure.com/language/mcp?api-version=…, available as a remote endpoint or hosted locally.
No routing logic required
The whole point is that you don't write task-routing code. The agent decides which tools to call from the tool descriptions.
Key concept · The tool-selection loop
(1) The user sends a prompt → (2) the agent analyzes it and determines the tasks → (3) it checks the available MCP tools and their descriptions for the best match → (4) it calls the selected tool(s) through the server with the input text → (5) the server runs the Azure Language capability and returns results → (6) the agent combines them into a natural-language reply. A single prompt — "what entities and dates are mentioned, and is it positive or negative?" — can trigger several tools, each processed independently and then synthesized.
Portal wiring, then code
In the Foundry portal: create a project, deploy a reasoning model (e.g. gpt-4.1), create an agent with instructions, then on the Tools page choose Connect a tool → Azure Language in Foundry Tools, configuring the resource name and key-based credential. Test in the Agent playground — the first tool use needs approval, which you can set to "always approve," and the Logs pane shows which tools ran.
Key concept · Consuming it from a client app
Build the client with azure-ai-projects and azure-identity: create an AIProjectClient, get its OpenAI client, and call the agent through the Responses API with an agent_reference. To wire the server in code instead of the portal, construct an MCPTool (server_label, server_url, require_approval) and pass it when creating the agent — use its allowed_tools property to restrict which tools are exposed. response.model_dump_json() reveals the underlying tool calls, arguments, and results.
Chapter 17 quiz
Thirteen questions on the server, autonomous tool selection, and connecting it. Answer first, then expand Show answer.
Part A · Multiple choice
What are the three components of an MCP architecture?
- A Host, client, and server
- B Model, index, and cache
- C Frontend, backend, database
- D Prompt, tool, memory
Show answer
A. Host runs the agent, client manages connections, server exposes tools.
What is MCP's key advantage over hardcoded tools?
- A Cheaper models
- B Dynamic tool discovery at runtime
- C Faster fine-tuning
- D Larger context windows
Show answer
B. Tools can change without modifying the agent.
Which is NOT one of the four Language MCP tools?
- A Language Detection
- B Named Entity Recognition
- C Image generation
- D Text Analytics for Health
Show answer
C — image generation. The four are detection, NER, PII redaction, and health.
Which tool extracts diagnoses, medications, and symptoms from clinical text?
- A PII Redaction
- B Text Analytics for Health
- C Language Detection
- D NER
Show answer
B — Text Analytics for Health.
Who decides which MCP tools to call for a given prompt?
- A The developer's routing code
- B The agent, from the tool descriptions
- C The MCP server admin
- D The end user manually
Show answer
B. No manual routing logic is required.
Which API do you use to call the agent from a client app?
- A The Responses API with an agent_reference
- B A raw SQL query
- C The Speech SDK
- D A GraphQL endpoint
Show answer
A. Via azure-ai-projects' OpenAI client.
Part B · True or false
An agent can call several Language tools from a single prompt.
Show answer
True. Each runs independently and results are synthesized into one reply.
The first tool use in the playground requires approval unless you enable "always approve."
Show answer
True. The Logs pane then shows which tools ran.
You can only connect the MCP server through the portal, never in code.
Show answer
False. You can construct an MCPTool in code and pass it when creating the agent.
The allowed_tools property restricts which of the server's tools are exposed.
Show answer
True. Useful for limiting an agent to specific capabilities.
Part C · Short answer
Name the four tools the Azure Language MCP server exposes.
Show answer
Language Detection, Named Entity Recognition, PII Redaction, and Text Analytics for Health.
Which two packages does the client application use?
Show answer
azure-ai-projects and azure-identity.
What does response.model_dump_json() let you inspect?
Show answer
The full response including the underlying tool calls, their arguments, and results.