ctx.sample(), the request lands on your client. Sampling adapters answer it with a real LLM in one line:
This page is under construction. The outline below sketches what it will cover.
- The adapters —
AnthropicSamplingAdapter,OpenAISamplingAdapter,GoogleSamplingAdapter, andGenericSamplingAdapterfor any custom completion function. Each translates MCP sampling params to its provider’s API, including tool-use round-trips. - Peer dependencies — provider SDKs are optional peers (install only what you use).
- Options —
modelSelector(static model name or a function of the server’s model preferences) andonTokenstreaming callbacks. - Capability advertisement — providing
handlers.samplingmakes the client advertise thesamplingcapability automatically.