Microsoft

AI-103 practice question 12

Developing AI Apps and Agents on Azure · free question 12 of 20

Question

You have a Microsoft Foundry project that contains an agent. The agent has a Model Context Protocol (MCP) tool that queries a knowledge base stored in Azure AI Search. Some agent runs return answers from the base model without invoking the knowledge base, which results in responses without grounded citations. You are provided with the following code snippet that runs the agent. You need to add the correct tool_choice parameter to the code to deterministically force the agent to invoke the MCP tool on each run. What should you add?
Python code calling project_client.agents.runs.create_and_process with thread_id and agent_id
  • A. tool_choice={"required"} Correct
  • B. tool_choice={"auto"}
  • C. tool_choice={"type":"knowledge_base"}
  • D. tool_choice={"type":"mcp"}

Explanation

Setting tool_choice to required gives deterministic behaviour because the model must call a tool, and the agent's knowledge base MCP tool is therefore used when processing the query. The value auto is the behaviour causing the problem, since it lets the model decide whether to call a tool. A knowledge_base type is not a tool_choice value for this scenario. The documented way to make an agent always use the knowledge base MCP tool is required, not a type setting of mcp.

Need the theory? Learn it free in the AI-103 course on Godlike Academy

Practice the whole free set

Answer all 20 free AI-103 questions with instant feedback, or unlock all 65 questions with Learn and Exam modes.