pub struct SamplingRequest {
pub messages: Vec<PromptMessage>,
pub max_tokens: u32,
pub system_prompt: Option<String>,
}Expand description
A request to ask the connected MCP client to run LLM inference
(“sampling”) — build one and pass it to McpContext::sample.
messages reuses PromptMessage rather than introducing a near-identical
type — the spec’s sampling message shape ({"role":...,"content":{"type":"text",...}})
is exactly what PromptMessage already models.
Fields§
§messages: Vec<PromptMessage>§max_tokens: u32§system_prompt: Option<String>An optional system prompt to steer the client’s model, per the
spec’s params.systemPrompt.
Auto Trait Implementations§
impl Freeze for SamplingRequest
impl RefUnwindSafe for SamplingRequest
impl Send for SamplingRequest
impl Sync for SamplingRequest
impl Unpin for SamplingRequest
impl UnsafeUnpin for SamplingRequest
impl UnwindSafe for SamplingRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more