pub struct Resource {
pub uri: String,
pub name: String,
pub title: Option<String>,
pub description: Option<String>,
pub mime_type: Option<String>,
pub size: Option<u64>,
pub annotations: Option<Annotations>,
pub meta: Option<HashMap<String, Value>>,
}
Expand description
Core MCP protocol types and error handling A resource descriptor (matches TypeScript Resource interface) Resource extends BaseMetadata, so it includes name and title fields
Fields§
§uri: String
The URI of this resource (format: uri)
name: String
Programmatic identifier (from BaseMetadata)
title: Option<String>
Human-readable display name (from BaseMetadata)
description: Option<String>
A description of what this resource represents
mime_type: Option<String>
The MIME type of this resource, if known
size: Option<u64>
The size of the raw resource content, in bytes
annotations: Option<Annotations>
Optional annotations for the client
meta: Option<HashMap<String, Value>>
See General fields: _meta for notes on _meta usage
Implementations§
Source§impl Resource
impl Resource
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> Resource
pub fn with_title(self, title: impl Into<String>) -> Resource
pub fn with_description(self, description: impl Into<String>) -> Resource
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Resource
pub fn with_size(self, size: u64) -> Resource
pub fn with_annotations(self, annotations: Annotations) -> Resource
pub fn with_meta(self, meta: HashMap<String, Value>) -> Resource
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Resource
impl<'de> Deserialize<'de> for Resource
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Resource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Resource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Resource
impl Serialize for Resource
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnwindSafe for Resource
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