pub struct CreateMessageRequestParams {
pub include_context: Option<CreateMessageRequestParamsIncludeContext>,
pub max_tokens: i64,
pub messages: Vec<SamplingMessage>,
pub metadata: Option<Map<String, Value>>,
pub model_preferences: Option<ModelPreferences>,
pub stop_sequences: Option<Vec<String>>,
pub system_prompt: Option<String>,
pub temperature: Option<f64>,
pub tool_choice: Option<ToolChoice>,
pub tools: Option<Vec<Tool>>,
}Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
Expand description
Parameters for a sampling/createMessage request.
Fields§
§include_context: Option<CreateMessageRequestParamsIncludeContext>The "thisServer" and "allServers" values are deprecated as of protocol version 2025-11-25 (SEP-2596) and will be removed no later than the Sampling feature itself (SEP-2577). Omit this field or use "none".
A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
Default is "none". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD
omit this field or use "none", and SHOULD only use the deprecated values if the client declares
ClientCapabilities.sampling.context.
max_tokens: i64Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
The requested maximum number of tokens to sample (to prevent runaway completions).
The client MAY choose to sample fewer tokens than the requested maximum.
messages: Vec<SamplingMessage>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
metadata: Option<Map<String, Value>>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
model_preferences: Option<ModelPreferences>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
The server’s preferences for which model to select. The client MAY ignore these preferences.
stop_sequences: Option<Vec<String>>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
system_prompt: Option<String>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
temperature: Option<f64>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
tool_choice: Option<ToolChoice>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
Controls how the model uses tools.
The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
Default is { mode: "auto" }.
tools: Option<Vec<Tool>>Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains in the specification for at least twelve months; see the deprecated features registry.
Tools that the model may use during generation.
The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
Implementations§
Source§impl CreateMessageRequestParams
impl CreateMessageRequestParams
Sourcepub fn new(
max_tokens: i64,
messages: Vec<SamplingMessage>,
) -> CreateMessageRequestParams
pub fn new( max_tokens: i64, messages: Vec<SamplingMessage>, ) -> CreateMessageRequestParams
Creates a value from its required fields; optional fields are None.
Trait Implementations§
Source§impl Clone for CreateMessageRequestParams
impl Clone for CreateMessageRequestParams
Source§fn clone(&self) -> CreateMessageRequestParams
fn clone(&self) -> CreateMessageRequestParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more