feat(SEP-973): add support for icons and websiteUrl across relevant types (#432)

This commit is contained in:
Alex Hancock 2025-09-11 11:49:03 -04:00 • committed by GitHub
commit b57aa47693
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use super::{Annotated, Meta};
use super::{Annotated, Icon, Meta};
/// Represents a resource in the extension with metadata
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
@ -26,6 +26,9 @@ pub struct RawResource {
/// This can be used by Hosts to display file sizes and estimate context window us
#[serde(skip_serializing_if = "Option::is_none")]
pub size: Option<u32>,
/// Optional list of icons for the resource
#[serde(skip_serializing_if = "Option::is_none")]
pub icons: Option<Vec<Icon>>,
}
pub type Resource = Annotated<RawResource>;
@ -91,6 +94,7 @@ impl RawResource {
description: None,
mime_type: None,
size: None,
icons: None,
}
}
}
@ -110,6 +114,7 @@ mod tests {
description: Some("Test resource".to_string()),
mime_type: Some("text/plain".to_string()),
size: Some(100),
icons: None,
};
let json = serde_json::to_string(&resource).unwrap();