pub struct ResourceReference {
pub uri: String,
pub name: String,
pub title: Option<String>,
pub description: Option<String>,
pub mime_type: Option<String>,
pub size: Option<u64>,
pub icons: Option<Vec<Icon>>,
pub annotations: Option<Annotations>,
pub meta: Option<HashMap<String, Value>>,
}Expand description
Core MCP protocol types and error handling Resource reference for resource links.
Mirrors the schema’s Resource interface so ContentBlock::ResourceLink
(which the schema declares as ResourceLink extends Resource) round-trips
all spec-permitted fields including size and icons.
Carries the same fields as crate::resources::Resource; the parallel
type is preserved for now because ContentBlock::ResourceLink flattens
this body and we don’t want to cascade the type swap through
prompts.rs/lib.rs re-exports in this slice. Collapsing onto a single
Resource struct is the cleaner end-state.
Fields§
§uri: StringThe URI of this resource
name: StringA human-readable name for this resource
title: Option<String>A human-readable title for this resource
description: Option<String>A description of what this resource represents or contains
mime_type: Option<String>The MIME type of this resource, if known
size: Option<u64>Size of the raw resource content, in bytes. Hosts use this for file-size display and context-window estimation.
icons: Option<Vec<Icon>>Display icons (from Resource extends Icons). Most consumers won’t need this.
annotations: Option<Annotations>Client annotations for this resource
meta: Option<HashMap<String, Value>>Additional metadata for this resource
Implementations§
Source§impl ResourceReference
impl ResourceReference
Sourcepub fn new(uri: impl Into<String>, name: impl Into<String>) -> ResourceReference
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> ResourceReference
Create resource reference
Sourcepub fn with_title(self, title: impl Into<String>) -> ResourceReference
pub fn with_title(self, title: impl Into<String>) -> ResourceReference
Add title
Sourcepub fn with_description(
self,
description: impl Into<String>,
) -> ResourceReference
pub fn with_description( self, description: impl Into<String>, ) -> ResourceReference
Add description
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> ResourceReference
pub fn with_mime_type(self, mime_type: impl Into<String>) -> ResourceReference
Add MIME type
Sourcepub fn with_size(self, size: u64) -> ResourceReference
pub fn with_size(self, size: u64) -> ResourceReference
Set the raw content size in bytes.
Sourcepub fn with_icons(self, icons: Vec<Icon>) -> ResourceReference
pub fn with_icons(self, icons: Vec<Icon>) -> ResourceReference
Attach display icons.
Sourcepub fn with_annotations(self, annotations: Annotations) -> ResourceReference
pub fn with_annotations(self, annotations: Annotations) -> ResourceReference
Add annotations
Trait Implementations§
Source§impl Clone for ResourceReference
impl Clone for ResourceReference
Source§fn clone(&self) -> ResourceReference
fn clone(&self) -> ResourceReference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more