#[non_exhaustive]pub struct ResourceInfo {
pub uri: String,
pub name: String,
pub title: Option<String>,
pub description: Option<String>,
pub mime_type: Option<String>,
pub icons: Option<Vec<IconInfo>>,
pub annotations: Option<Annotations>,
pub meta: Option<Map<String, Value>>,
}Expand description
Resource information.
§Construction
Use ResourceInfo::new for ergonomic construction:
use pmcp::types::ResourceInfo;
let resource = ResourceInfo::new("file://test.txt", "test.txt")
.with_description("A test file")
.with_mime_type("text/plain");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.uri: StringResource URI
name: StringHuman-readable name
title: Option<String>Optional human-readable title (MCP 2025-11-25)
description: Option<String>Resource description
mime_type: Option<String>MIME type
icons: Option<Vec<IconInfo>>Optional icons (MCP 2025-11-25)
annotations: Option<Annotations>Optional content annotations (MCP 2025-11-25)
meta: Option<Map<String, Value>>Optional metadata (e.g., widget descriptor keys for ChatGPT MCP Apps)
Implementations§
Source§impl ResourceInfo
impl ResourceInfo
Sourcepub fn new(uri: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(uri: impl Into<String>, name: impl Into<String>) -> Self
Create a new resource with the required URI and name fields.
All optional fields default to None.
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set the human-readable title.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the resource description.
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Set the MIME type.
Sourcepub fn with_icons(self, icons: Vec<IconInfo>) -> Self
pub fn with_icons(self, icons: Vec<IconInfo>) -> Self
Set the resource icons.
Sourcepub fn with_annotations(self, annotations: Annotations) -> Self
pub fn with_annotations(self, annotations: Annotations) -> Self
Set content annotations.
Trait Implementations§
Source§impl Clone for ResourceInfo
impl Clone for ResourceInfo
Source§fn clone(&self) -> ResourceInfo
fn clone(&self) -> ResourceInfo
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 Debug for ResourceInfo
impl Debug for ResourceInfo
Source§impl Default for ResourceInfo
impl Default for ResourceInfo
Source§fn default() -> ResourceInfo
fn default() -> ResourceInfo
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ResourceInfo
impl<'de> Deserialize<'de> for ResourceInfo
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ResourceInfo
impl RefUnwindSafe for ResourceInfo
impl Send for ResourceInfo
impl Sync for ResourceInfo
impl Unpin for ResourceInfo
impl UnsafeUnpin for ResourceInfo
impl UnwindSafe for ResourceInfo
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