pub struct ResourceContent {
pub uri: String,
pub mime_type: Option<String>,
pub text: Option<String>,
pub blob: Option<String>,
}Expand description
Resource content for MCP resources/read responses
Automatically includes uri and mimeType per MCP spec. Use this type for Resource::read() return values.
§Examples
ⓘ
// Simple text resource
ResourceContent::text("file:///path", "content here")
// With specific MIME type
ResourceContent::text("file:///path", "content")
.with_mime_type("application/json")
// Binary resource
ResourceContent::blob("file:///path", base64_data, "image/png")Fields§
§uri: StringResource URI (required)
mime_type: Option<String>MIME type
text: Option<String>Text content (mutually exclusive with blob)
blob: Option<String>Binary content as base64 (mutually exclusive with text)
Implementations§
Trait Implementations§
Source§impl Clone for ResourceContent
impl Clone for ResourceContent
Source§fn clone(&self) -> ResourceContent
fn clone(&self) -> ResourceContent
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 moreSource§impl Content for ResourceContent
impl Content for ResourceContent
Source§fn content_type(&self) -> &'static str
fn content_type(&self) -> &'static str
Get the content type identifier
Source§fn annotations(&self) -> Option<&Annotations>
fn annotations(&self) -> Option<&Annotations>
Get annotations if present
Source§impl Debug for ResourceContent
impl Debug for ResourceContent
Auto Trait Implementations§
impl Freeze for ResourceContent
impl RefUnwindSafe for ResourceContent
impl Send for ResourceContent
impl Sync for ResourceContent
impl Unpin for ResourceContent
impl UnwindSafe for ResourceContent
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