pub enum CoreRequest {
Legacy(LegacyCoreRequest),
Final(FinalCoreRequest),
}Expand description
Public, era-aware dispatch for the currently supported core request set.
Variants§
Legacy(LegacyCoreRequest)
Exact MCP 2024-11-05 request vocabulary.
Final(FinalCoreRequest)
Final MCP 2026-07-28 request vocabulary.
Implementations§
Source§impl CoreRequest
impl CoreRequest
Sourcepub fn decode(
era: ProtocolEra,
method: &str,
params: Option<&Value>,
) -> Result<Self, CoreDispatchError>
pub fn decode( era: ProtocolEra, method: &str, params: Option<&Value>, ) -> Result<Self, CoreDispatchError>
Decodes one core request only through the exact protocol era selected by the connection. The two request vocabularies are deliberately disjoint even where their method literals are shared.
Sourcepub fn decode_with_raw_params(
era: ProtocolEra,
method: &str,
params: Option<&Value>,
raw_params: Option<&str>,
) -> Result<Self, CoreDispatchError>
pub fn decode_with_raw_params( era: ProtocolEra, method: &str, params: Option<&Value>, raw_params: Option<&str>, ) -> Result<Self, CoreDispatchError>
Decodes one core request while retaining the admitted raw parameter source for final MRTR retry maps.
The ordinary Self::decode path accepts a materialized
Value, whose object representation cannot retain member order.
Callers that admitted the original parameter source can use this form
for the three final methods whose inputResponses maps have typed,
ordered response entries. The supplied source must describe exactly the
same parameter value as params; it cannot be attached to another
admitted frame.
Sourcepub const fn era(&self) -> ProtocolEra
pub const fn era(&self) -> ProtocolEra
Returns the era selected by this request.
Sourcepub const fn method(&self) -> &'static str
pub const fn method(&self) -> &'static str
Returns the exact core method literal selected by this request.
Sourcepub fn encode_params(&self) -> Result<Option<Value>, CoreDispatchError>
pub fn encode_params(&self) -> Result<Option<Value>, CoreDispatchError>
Encodes the method-owned parameter object without adding a JSON-RPC envelope. Final requests revalidate their common metadata before serialization so local callers cannot emit a cross-era request.
Sourcepub fn decode_result(
&self,
input: &str,
) -> Result<CoreResult, CoreDispatchError>
pub fn decode_result( &self, input: &str, ) -> Result<CoreResult, CoreDispatchError>
Decodes the JSON-RPC result payload selected by this request.
Sourcepub fn decode_response(
&self,
response: &JsonRpcResponse,
) -> Result<CoreResult, CoreDispatchError>
pub fn decode_response( &self, response: &JsonRpcResponse, ) -> Result<CoreResult, CoreDispatchError>
Decodes a successful JSON-RPC response selected by this request.
This form preserves the response correlation context required by final
subscriptions/listen: its result metadata subscription ID must equal
the enclosing JSON-RPC response ID. This Value-only API is lossy for
received member order and noncanonical numeric lexemes; callers with
admitted source must use Self::decode_response_result.
Sourcepub fn decode_response_result(
&self,
response: &JsonRpcResponse,
result_source: &str,
) -> Result<CoreResult, CoreDispatchError>
pub fn decode_response_result( &self, response: &JsonRpcResponse, result_source: &str, ) -> Result<CoreResult, CoreDispatchError>
Decodes a successful JSON-RPC response from its admitted result source.
Unlike Self::decode_response, this path does not serialize the
response’s Value again. The caller supplies the exact source JSON
retained while the response frame was admitted, preserving object
member order and number lexemes for the lossless result algebra. The
parsed value must still equal the response’s typed result so source from
a different response cannot be attached accidentally.
Trait Implementations§
Source§impl Clone for CoreRequest
impl Clone for CoreRequest
Source§fn clone(&self) -> CoreRequest
fn clone(&self) -> CoreRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more