< Previous Challenge - Home - Next Challenge >
Contoso Yacht’s “Citrus Bus” application features multiple AI-powered virtual assistants that can be used by both its customer service team and Contoso Yacht’s customers. The virtual assistants augment customer service and can be leveraged to interact with customers during off-hours or when the customer service team is extremely busy.
There are three virtual assistants that you will experiment with during this challenge:
The virtual assistants use information available in vector databases and other APIs to read and write to these data stores while providing assistance to the customers. They also allow customers to create accounts, manage bank account balances, and make or cancel yacht reservations with Contoso Yachts. There are two existing customers in the Citrus Bus application database and there are 5 yachts that customers can make future reservations for a specific date and yacht.
The Donald & Callum assistants are fully implemented and you will explore their functionality during this challenge. The main focus of this challenge is to extend the Veta virtual assistant’s functionality using Model Context Protocol (MCP) to consider the current weather forecast when booking a yacht reservation.
MCP is an open protocol that allows us to standardize how tools and data is provided to LLMs. Before MCP, one would have to do custom integrations for tools based on the specific APIs and models that are being used. However, with MCP you can make one server which has the tools, and the agents can directly talk to the server and access those tools in a standardized way. Below is a diagram of how MCP works (credit to Anthropic for the diagram).
Host - The user facing application that manages different clients, enforces security policies, and coordinates AI integration. The main job of a host is to facilitate user interactions and initiate connections to servers via clients.
Client - Maintains a 1:1 connection with the specific server using the MCP protocol as shown in the diagram above. The main job of a client is to manage bidirectional communication and maintain session state and security boundaries.
Server - Provides specialized capabilities and access to resources such as data and APIs. This can be local or remote. The main job of the server is to give tools, data, or prompts to the client.
There are many security aspects to consider when using MCP for enterprise applications, your coach should cover these during the lecture for this challenge. There is also a link provided in the Learning Resources section below about security, that you can read for more guidance and details..
The goal of this challenge is explore the existing functionality of the virtual assistants, then extend the functionality of the Veta virtual assistant to consider the current weather forecast when booking a yacht reservation. Finally, you will test all of the assistants to ensure they work properly.
The virtual assistants are configured with System Messages (prompts) to use Tools (functions/APIs) to complete their tasks.
Please view the configuration files in the /ContosoAIAppsBackend/assistant_configurations
folder for the Donald, Veta, and Callum assistants to understand what each of the assistants do.
.txt
file for each assistant contains the system message (prompt) that specifies to the LLM how the assistant should behave.json
file for each assistant specifies what tools (functions/APIs) the assistants have the ability to invoke.As you will be extending Veta’s functionality, note the following requirements for Veta:
At the end of this challenge, you will test each of the assistant’s functionalities to see them in action.
In this challenge, you will configure and build an MCP server that connects the Veta assistant to the National Weather Service API.
In your /data/mcp-info
folder there is an llm-full.txt
file that contains detailed instructions to give LLMs on how to build an MCP server. Your job in this hack is to feed that file and the given prompt to GitHub Copilot and build an MCP server that connects Veta, the the booking assistant to the national weather service API. This functionality will help you check the weather before booking the yacht reservation to tour Contoso Islands.
We have already configured the the MCP client files and all the necessary architecture, your task is to fill in the missing code in mcp_weather_server.py
located in /ContosoAIAppsBackend/mcp
folder to build the MCP server component with the help of GitHub Copilot.
Use the llm-full.txt
file in /data/mcp-info
and the prompt below to ensure that the MCP server is built properly:
Complete the functions with TODO in the mcp_weather_server.py file to have the proper functionality and look the llms-full.txt file to do so. Carefully look at the mcp_weather_client file to ensure the names of functions are the same to ensure they can call each other. Also look at veta.txt and veta.json to know what the agent functionality is supposed to be. Make the code as simple as possible to have proper functionality. Only change the server file since everything else is properly configured to work with a properly configured server.
In the /data
folder you will find a set of documentation files that were generated by AI. We recommend optionally reading through these files to help you learn and fully understand what the code does:
llm-full.txt
, veta.json
, veta.txt
, mcp_weather_server.py
, ask_veta.py
, IMPLEMENTATION_SUMMARY.md
, MCP_WEATHER_INTEGRATION.md
, MCP_WEATHER_README.md
, and the ContosoAIAppsBackend
folder.veta.txt
and change them to your current location to see how accurate the weather is (you will have the kill the terminal and restart the front and backend after making any changes to the app).This is how the sync between the client and server is initialized.
Veta Assistant Request
↓
Weather Tools Called
↓
SyncMCPWeatherClient._ensure_client()
↓
Start subprocess: python mcp_weather_server.py
↓
JSON-RPC handshake:
- initialize request
- capabilities exchange
- initialized notification
This is a flow of the user query, showing which functions are activated when a prompt is given to the Veta Assistant. This is the general flow that your prompt takes before the Assistant gives you back the response.
User: "Book yacht for tomorrow"
↓
Veta: Check weather conditions
↓
Weather Tools: v_get_weather_summary_for_client()
↓
MCP Client: get_weather_summary()
↓
JSON-RPC: tools/call request
↓
MCP Server: handle_call_tool()
↓
HTTP Request: NWS API
↓
Format & Return: Client-friendly summary
↓
Veta: Present weather to customer
You can use the rest-api-ask-assistants.http
REST Client in the /ContosoAIAppsBackend
folder to test and debug directly against the backend how the assistants will respond. We recommend you use the REST Client so that you will be able to view and troubleshoot any error messages you receive.
The question you have for the AI assistant needs to be in the message
field for the JSON object for the body of the HTTP request.
Once you have proved the backend is responding properly using the REST Client, you can navigate to the Frontend webpage for the assistants to send your questions to each one.
To complete the challenge successfully, the solution should demonstrate the following:
Here are a list of resources that should assist you with completing this challenge: