Skip to main content

CoreRequest

Enum CoreRequest 

Source
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

Source

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.

Source

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.

Source

pub const fn era(&self) -> ProtocolEra

Returns the era selected by this request.

Source

pub const fn method(&self) -> &'static str

Returns the exact core method literal selected by this request.

Source

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.

Source

pub fn decode_result( &self, input: &str, ) -> Result<CoreResult, CoreDispatchError>

Decodes the JSON-RPC result payload selected by this request.

Source

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.

Source

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

Source§

fn clone(&self) -> CoreRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CoreRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V