pub struct ResourceLink {
pub uri: Uri,
pub name: String,
pub size: Option<usize>,
pub mime: Option<String>,
pub title: Option<String>,
pub descr: Option<String>,
pub annotations: Option<Annotations>,
pub icons: Option<Vec<Icon>>,
pub meta: Option<Value>,
}Expand description
A resource that the server is capable of reading, included in a prompt or tool call result.
Note: resource links returned by tools are not guaranteed to appear in the results of resources/list requests.
See the schema for details
Fields§
§uri: UriThe URI of this resource.
name: StringIntended for programmatic or logical use
but used as a display name in past specs or fallback (if a title isn’t present).
size: Option<usize>The resource size in bytes, if known
mime: Option<String>The MIME type of the resource. If known.
title: Option<String>Intended for UI and end-user contexts - optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name, if present).
descr: Option<String>A description of what this resource represents.
annotations: Option<Annotations>Optional annotations for the client.
icons: Option<Vec<Icon>>Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
meta: Option<Value>Metadata reserved by MCP for protocol-level metadata.
Implementations§
Source§impl ResourceLink
impl ResourceLink
Sourcepub fn new(resource: impl Into<Resource>) -> Self
pub fn new(resource: impl Into<Resource>) -> Self
Creates a new ResourceLink content
Sourcepub fn with_icons(self, icons: impl IntoIterator<Item = Icon>) -> Self
pub fn with_icons(self, icons: impl IntoIterator<Item = Icon>) -> Self
Sets the ResourceLink icons
Trait Implementations§
Source§impl Clone for ResourceLink
impl Clone for ResourceLink
Source§fn clone(&self) -> ResourceLink
fn clone(&self) -> ResourceLink
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceLink
impl Debug for ResourceLink
Source§impl<'de> Deserialize<'de> for ResourceLink
impl<'de> Deserialize<'de> for ResourceLink
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Resource> for ResourceLink
impl From<Resource> for ResourceLink
Source§impl From<ResourceLink> for Content
impl From<ResourceLink> for Content
Source§fn from(value: ResourceLink) -> Self
fn from(value: ResourceLink) -> Self
Source§impl Serialize for ResourceLink
impl Serialize for ResourceLink
Auto Trait Implementations§
impl Freeze for ResourceLink
impl RefUnwindSafe for ResourceLink
impl Send for ResourceLink
impl Sync for ResourceLink
impl Unpin for ResourceLink
impl UnwindSafe for ResourceLink
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)