pub struct StreamableHttpContext {
pub protocol_version: McpProtocolVersion,
pub session_id: Option<String>,
pub wants_sse_stream: bool,
pub accepts_stream_frames: bool,
pub headers: HashMap<String, String>,
}
Expand description
Streamable HTTP request context
Fields§
§protocol_version: McpProtocolVersion
Protocol version negotiated
session_id: Option<String>
Session ID if provided
wants_sse_stream: bool
Whether client wants SSE stream (text/event-stream)
accepts_stream_frames: bool
Whether client accepts stream frames (application/json, text/event-stream, or /)
headers: HashMap<String, String>
Additional request headers
Implementations§
Source§impl StreamableHttpContext
impl StreamableHttpContext
Sourcepub fn from_request<T>(req: &Request<T>) -> Self
pub fn from_request<T>(req: &Request<T>) -> Self
Parse context from HTTP request headers
Sourcepub fn wants_sse_stream(&self) -> bool
pub fn wants_sse_stream(&self) -> bool
Whether client wants SSE stream
Sourcepub fn wants_streaming_post(&self) -> bool
pub fn wants_streaming_post(&self) -> bool
Whether client wants streaming POST responses
Sourcepub fn is_streamable_compatible(&self) -> bool
pub fn is_streamable_compatible(&self) -> bool
Check if request is compatible with streamable HTTP
Sourcepub fn validate(&self, method: &Method) -> Result<(), String>
pub fn validate(&self, method: &Method) -> Result<(), String>
Validate request for MCP compliance
Sourcepub fn response_headers(&self) -> HeaderMap
pub fn response_headers(&self) -> HeaderMap
Create response headers for this context
Trait Implementations§
Source§impl Clone for StreamableHttpContext
impl Clone for StreamableHttpContext
Source§fn clone(&self) -> StreamableHttpContext
fn clone(&self) -> StreamableHttpContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for StreamableHttpContext
impl RefUnwindSafe for StreamableHttpContext
impl Send for StreamableHttpContext
impl Sync for StreamableHttpContext
impl Unpin for StreamableHttpContext
impl UnwindSafe for StreamableHttpContext
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