Understanding MCP client concepts
findBestFlight
that uses sampling to analyze available flights and recommend the optimal choice. When a user asks “Book me the best flight to Barcelona next month,” the tool needs AI assistance to evaluate complex trade-offs.
The tool queries airline APIs and gathers 47 flight options. It then requests AI assistance to analyze these options: “Analyze these flight options and recommend the best choice: [47 flights with prices, times, airlines, and layovers] User preferences: morning departure, max 1 layover.”
The client asks the user: “Allow sampling request?” Upon approval, the AI evaluates trade-offs—like cheaper red-eye flights versus convenient morning departures. The tool uses this analysis to present the top three recommendations.
includeContext
parameter.
Isolation: Sampling requests are isolated from the main conversation context by default. Servers cannot access user conversations.
Security considerations: Both clients and servers must handle sensitive data appropriately during sampling. Clients should implement rate limiting and validate all message content. The human-in-the-loop design ensures that server-initiated AI interactions cannot compromise security or access sensitive data without explicit user consent.
file://
URI scheme. They help servers understand project boundaries, workspace organization, and accessible directories. The roots list can be updated dynamically as users work with different projects or folders, with servers receiving notifications through roots/list_changed
when boundaries change.
It’s important to note that while roots provide guidance to servers about where to operate, the client is always in full control of file access. Roots simply communicate intended boundaries—actual file access is always mediated by the client’s security policies.
file:///Users/agent/travel-planning
- Main workspace containing all travel filesfile:///Users/agent/travel-templates
- Reusable itinerary templates and resourcesfile:///Users/agent/client-documents
- Client passports and travel documentsfile:///Users/agent/archive/2023-trips
, the client updates the roots list via roots/list_changed
.
/travel-templates
for reusable resources while excluding directories with financial records.