Expand description
MCP-Compliant Client-Side Sampling Support
This module provides the correct MCP architecture for handling sampling requests. The client’s role is to:
- Receive sampling/createMessage requests from servers
- Present them to users for approval (human-in-the-loop)
- Delegate to external LLM services (which can be MCP servers themselves)
- Return standardized results
§Perfect MCP Compliance
Unlike embedding LLM APIs directly (anti-pattern), this implementation:
- Delegates to external services
- Maintains protocol boundaries
- Enables composition and flexibility
- Provides maximum developer experience through simplicity
Structs§
- Auto
Approving User Handler - Default user handler that automatically approves (for development)
- Delegating
Sampling Handler - Default implementation that delegates to external MCP servers
- Server
Info - Server information for model selection
Traits§
- LLMServer
Client - Interface for connecting to LLM MCP servers
- Sampling
Handler - MCP-compliant sampling handler trait
- User
Interaction Handler - Interface for user interaction (human-in-the-loop)