pub struct CreateMessageRequest {
pub messages: Vec<SamplingMessage>,
pub model_preferences: Option<ModelPreferences>,
pub system_prompt: Option<String>,
pub include_context: Option<IncludeContext>,
pub temperature: Option<f64>,
pub max_tokens: u32,
pub stop_sequences: Option<Vec<String>>,
pub tools: Option<Vec<Tool>>,
pub tool_choice: Option<ToolChoice>,
pub task: Option<TaskMetadata>,
pub _meta: Option<Value>,
}Expand description
Create message request (for LLM sampling)
Fields§
§messages: Vec<SamplingMessage>Messages to include in the sampling request
model_preferences: Option<ModelPreferences>Model preferences (optional)
system_prompt: Option<String>System prompt (optional)
include_context: Option<IncludeContext>Include context from other servers
temperature: Option<f64>Temperature for sampling (0.0 to 2.0)
max_tokens: u32Maximum number of tokens to generate (required by MCP spec)
stop_sequences: Option<Vec<String>>Stop sequences
tools: Option<Vec<Tool>>Tools that the model may use during generation (MCP 2025-11-25 draft, SEP-1577) The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared
tool_choice: Option<ToolChoice>Controls how the model uses tools (MCP 2025-11-25 draft, SEP-1577)
The client MUST return an error if this field is provided but
ClientCapabilities.sampling.tools is not declared
Default is { mode: "auto" }
task: Option<TaskMetadata>Task metadata for task-augmented sampling (MCP 2025-11-25 draft, SEP-1686)
When present, indicates the client should execute this sampling request as a long-running task and return a CreateTaskResult instead of the immediate CreateMessageResult. The actual result can be retrieved later via tasks/result.
_meta: Option<Value>Optional metadata per MCP 2025-11-25 specification
Trait Implementations§
Source§impl Clone for CreateMessageRequest
impl Clone for CreateMessageRequest
Source§fn clone(&self) -> CreateMessageRequest
fn clone(&self) -> CreateMessageRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more