Conclusion
In this lesson, you moved beyond simple request-response patterns and implemented the sophisticated behaviors required for production-grade AI agents.
- You mastered Elicitation: You transformed a dangerous “delete” command into a safe, interactive conversation. You learned that by implementing a custom client handler, you can keep humans in the loop for high-stakes decisions.
- You secured your system with Roots: You recognized the risks of giving AI access to files. By implementing path validation logic in your server and defining a sandbox in your client, you ensured that your agents can only touch what they are supposed to.
- You leveraged Sampling: You optimized your architecture by letting the server “borrow” the client’s brain. You built a system where a tool could perform intelligent analysis without needing its own API key, keeping your backend lightweight and cost-effective.
These three features, Interactivity (Elicitation), Security (Roots), and Distributed Intelligence (Sampling), are what separate basic chatbots from robust, professional AI systems.
You now possess a comprehensive understanding of the Model Context Protocol, from the basic building blocks of Tools and Resources to the advanced coordination of client-server interactions.