diff --git a/articles/ai-foundry/agents/how-to/tools/model-context-protocol-samples.md b/articles/ai-foundry/agents/how-to/tools/model-context-protocol-samples.md index cd2923386d..65641db967 100644 --- a/articles/ai-foundry/agents/how-to/tools/model-context-protocol-samples.md +++ b/articles/ai-foundry/agents/how-to/tools/model-context-protocol-samples.md @@ -155,6 +155,8 @@ agentClient.Administration.DeleteAgent(agentId: agent.Id); The following code sample begins by setting up the necessary imports, getting the relevant MCP server configuration, and initializing the AI Project client. It then creates an agent, adds a message to a thread, and runs the agent. +> [!NOTE] +> To run the following code, `azure.ai.projects==1.1.0b4` and `azure.ai.agents==1.2.0b4` are required. ```python # Import necessary libraries @@ -343,19 +345,19 @@ curl --request POST \ --url $AZURE_AI_FOUNDRY_PROJECT_ENDPOINT/assistants?api-version=$API_VERSION \ -H "Authorization: Bearer $AGENT_TOKEN" \ -H "Content-Type: application/json" \ - -d "{ + -d '{ "instructions": "You are a customer support chatbot. Use the tools provided and your knowledge base to best respond to customer queries.", "tools": [ - { - "type": "mcp", - "server_label": "", - "server_url": "", - "allowed_tools": [""], # optional - } - ], - "name": "my-assistant", - "model": "gpt-4o", -}" + { + "type": "mcp", + "server_label": "", + "server_url": "", + "allowed_tools": [""] # optional + } + ], + "name": "my-assistant", + "model": "gpt-4o" + }' ``` ## Create a thread @@ -400,17 +402,16 @@ curl --request POST \ -d '{ "assistant_id": "", "tool_resources": { - "mcp": [ - { - "server_label": "", - "require_approval": "always" #always by default - "headers": { - "Authorization": "Bearer ", - } - + "mcp": [ + { + "server_label": "", + "require_approval": "always", #always by default + "headers": { + "Authorization": "Bearer " } - ] - }, + } + ] + } }' ``` @@ -470,15 +471,15 @@ curl --request POST \ -H "Authorization: Bearer $AGENT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ - "tool_approvals": [ - { - "tool_call_id": "call_abc123", - "approve": true, - "headers": { - } + "tool_approvals": [ + { + "tool_call_id": "call_abc123", + "approve": true, + "headers": { } + } ] -} + }' ``` ## Retrieve the agent response