Deterministically Force MCP Tool Invocation in Microsoft Foundry

Answer Correct answer: D — Add tool_choice={"type":"mcp"} to the code snippet to deterministically force the agent to invoke the MCP tool on each run.

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. exhibit 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?

  1. tool_choice={“required”}
  2. tool_choice={“auto”}
  3. tool_choice={“type”:“knowledge_base”}
  4. tool_choice ={“type”:“mcp”} Correct Answer

Community Insight

The exam tests the distinction between forcing any tool usage versus forcing a specific tool type, with the common trap being the selection of 'required' which does not guarantee the correct tool is used if multiple tools are present.

This question examines how to configure the tool_choice parameter in Microsoft Foundry agents to ensure deterministic invocation of a specific Model Context Protocol (MCP) tool. It clarifies that specifying the tool type is required to prevent the base model from answering without grounding.

Many learners choose 'required' because it forces tool usage, but they fail to realize that 'required' allows the agent to pick any available tool, whereas the question demands the specific MCP tool be invoked.

Community Discussion (13 comments)

a5f05ea 👍 1 Selected: A
For those answering D, understand question, it says deterministically force the agent to invoke the MCP tool. Now with option D it just tell agent you've a tool but it doesn't force the agent to use that tool. But option A forces agent to use the tool, which is the ask.
Sky_Akash 👍 2 Selected: D
Why not A ({"required"})? {"required"} only ensures some tool is used, not specifically the MCP tool. If multiple tools exist, the agent could pick another one. The question explicitly says “deterministically force the agent to invoke the MCP tool”, so you must specify its type. So even though A is “most voted,” D is the technically correct and exam-accurate choice.
Srikantha 👍 1 Selected: A
Why Option D is Incorrect Option D (tool_choice={"type":"mcp"}) is incorrect because it violates the expected schema for the Azure OpenAI API, which powers Microsoft Foundry agents.
3f9a492 👍 3 Selected: A
Must use a tool every run → required The option displays tool_choice={"required"}, but proper Python SDK syntax is normally tool_choice="required"
rqFamily 👍 1 Selected: A
Force-by-type works only when the type uniquely identifies one tool, so you do tool_choice={"type":"file_search"}, otherwise you do {"type":"mcp","name":"mcptoolname"}, so our only option is A
Mattt 👍 6 Selected: D
D is more precise. required only forces the use of some tool, while {"type":"mcp"} explicitly forces the MCP tool. Also, option A uses incorrect Python syntax.
RPC112 👍 2 Selected: A
Its not D. Its A. The question says:"force the agent to invoke the MCP tool on each run" The documented behavior of tool_choice="required" is: Force the model to call a tool instead of answering directly. That directly addresses the problem statement: Some runs return answers from the base model without invoking the knowledge base. D. tool_choice={"type":"mcp"} MCP is the tool protocol, not the standard tool_choice value used to force invocation. Simply specifying "mcp" does not represent the documented way to require tool use.
CharlieMike 👍 1 Selected: A
tool_choice("required") forces the agent to invoke a tool every time. Since the MCP tool is the only applicable tool, the agent will use it on every run, ensuring grounded responses with citations instead of answering from the base model.
Srini7 👍 1 Selected: D
Its D. Question Clearly state " add the correct tool _choice parameter to the code to deterministically force the agent to invoke the MCP tool on each run" in that case, we can't say "required" , becuase if you have more than one tool , its not valid. So answer is D
Danielly 👍 1 Selected: D
Its D because tool_choice="required" only forces it to use a tool its not speficifed if the agent has other tools . Then you have to force that SPECIFIC tool
cloudera 👍 3 Selected: A
Syntax error but I will still go with A: tool_choice="required" The issue is that the agent sometimes answers from the base model without calling the knowledge base tool. tool_choice="required" forces the agent to call a tool on each run, which prevents it from skipping retrieval and helps ensure grounded citations. D is tempting because MCP is the tool type, but the question is about forcing tool use at runtime, not defining the MCP tool itself. For more - https://learn.microsoft.com/en-us/azure/search/agentic-retrieval-how-to-create-pipeline
RICHARDALEX007 👍 1 Selected: D
To deterministically force a SPECIFIC tool, tool_choice must name the tool by type, so {"type":"mcp"} (D) is the intent. 'auto' (B) lets the model decide (the current bug), and {"required"} (A) is malformed set syntax; 'required' as a value forces some tool but not specifically the MCP one. The exact accepted schema for MCP tool_choice should be confirmed against the current Agents SDK
shank23 👍 1 Selected: A
"required" explicitly forces the model to select and execute at least one tool before returning a text response. This overrides the base model's default behavior, ensuring it cannot answer directly using only its pre-trained internal weights

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The correct option is D: tool_choice={"type":"mcp"}. The question explicitly asks to "deterministically force the agent to invoke the MCP tool." In the Azure OpenAI API and Microsoft Foundry context, setting tool_choice to an object with a type property binds the call to tools of that specific type. Since the MCP tool is defined by its type, this ensures the agent calls the knowledge base retrieval tool rather than relying on internal knowledge.

Why the Other Options Are Wrong

Option A ({"required"} or similar syntax) forces the model to call a tool, but if multiple tools were registered, the agent might choose one other than the MCP tool. Option B ({"auto"}) allows the model to decide whether to use a tool, which leads to the problem described (skipping the KB). Option C uses a non-standard value knowledge_base which is not a valid tool type identifier in the underlying API schema.

Community Comment Notes

Several users correctly identified that 'required' is insufficient for deterministic targeting of a specific tool. As user Sky_Akash noted, "{\"required\"} only ensures some tool is used, not specifically the MCP tool." User Mattt also highlighted that D is more precise because it explicitly targets the MCP type, whereas A is generic. Some users pointed out syntax nuances, but the semantic requirement of 'deterministic' invocation points to D.

Exam Strategy

Always read the keyword 'deterministically' or 'specifically' in agent configuration questions. If the goal is to target a specific capability (like search or code execution), look for options that specify the tool type or name, not just 'required'.

Frequently Asked Questions

Why isn't tool_choice="required" sufficient?

Because 'required' only forces the use of any tool. If multiple tools exist, the agent could pick the wrong one. The question requires the specific MCP tool.

What does deterministically mean here?

It means the outcome is predictable and fixed. Using the tool type ensures the exact same tool is called every time, preventing the base model from skipping it.

More AI-103 FAQ →

Related Analysis

Practice All AI-103 Questions

Access 88 questions with complete answers and detailed explanations.

View Full AI-103 Practice Test →

← Back to AI-103 Study Guide