pub enum ResourceBody {
Json(Value),
Text {
mime_type: String,
content: String,
},
}Expand description
The payload of a resource read, carrying both MIME type and serialized content. Different resources speak different formats (JSON for metadata, markdown for human overviews, CSV for spreadsheet consumers), so the resource layer needs to pass both along to the MCP client.
Json variants are pretty-printed when rendered; Text variants are
emitted verbatim. Tests and prompt helpers can still access the
underlying JSON via ResourceBody::as_json when it’s a JSON payload.
Variants§
Json(Value)
Structured JSON — rendered as pretty-printed application/json.
Text
Free-form text with an explicit MIME type (e.g. text/markdown,
text/csv).
Implementations§
Trait Implementations§
Source§impl Clone for ResourceBody
impl Clone for ResourceBody
Source§fn clone(&self) -> ResourceBody
fn clone(&self) -> ResourceBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ResourceBody
impl RefUnwindSafe for ResourceBody
impl Send for ResourceBody
impl Sync for ResourceBody
impl Unpin for ResourceBody
impl UnsafeUnpin for ResourceBody
impl UnwindSafe for ResourceBody
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request