Skip to main content

SamplingCallback

Type Alias SamplingCallback 

Source
pub type SamplingCallback = Arc<dyn Fn(SamplingRequest) -> Result<SamplingResponse, String> + Send + Sync>;
Expand description

Callback type for handling sampling requests.

MCP servers can request LLM completions from the client via the sampling/createMessage method. This callback bridges that request to whatever LLM backend the host provides (e.g. tl-ai).

Aliased Typeยง

pub struct SamplingCallback { /* private fields */ }