#[non_exhaustive]pub struct IconInfo {
pub src: String,
pub mime_type: Option<String>,
pub sizes: Option<Vec<String>>,
pub theme: Option<IconTheme>,
}Expand description
Icon information for entities (MCP 2025-11-25).
§Backward Compatibility
This struct is #[non_exhaustive]. Use the constructor to remain
forward-compatible:
use pmcp::types::protocol::IconInfo;
let icon = IconInfo::new("https://example.com/icon.png")
.with_mime_type("image/png")
.with_sizes(vec!["32x32".to_string()]);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.src: StringIcon source URL.
Serialized as src per the MCP 2025-11-25 spec. Accepts url as a
deserialize alias for backwards compat with pre-2025-11-25 servers.
mime_type: Option<String>Icon MIME type
sizes: Option<Vec<String>>Icon sizes (e.g., ["16x16", "32x32"])
theme: Option<IconTheme>Icon theme preference
Implementations§
Source§impl IconInfo
impl IconInfo
Sourcepub fn new(src: impl Into<String>) -> Self
pub fn new(src: impl Into<String>) -> Self
Create an IconInfo with the icon source URL.
Optional fields (mime_type, sizes, theme) default to None.
The argument is serialized as src per MCP 2025-11-25 spec.
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 for the icon.
Sourcepub fn with_sizes(self, sizes: Vec<String>) -> Self
pub fn with_sizes(self, sizes: Vec<String>) -> Self
Set the icon sizes (e.g., [“16x16”, “32x32”]).
Sourcepub fn with_theme(self, theme: IconTheme) -> Self
pub fn with_theme(self, theme: IconTheme) -> Self
Set the icon theme preference.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IconInfo
impl<'de> Deserialize<'de> for IconInfo
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 IconInfo
impl RefUnwindSafe for IconInfo
impl Send for IconInfo
impl Sync for IconInfo
impl Unpin for IconInfo
impl UnsafeUnpin for IconInfo
impl UnwindSafe for IconInfo
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