feat(meta): add _meta field to prompts, resources and paginated result (#558)

This commit is contained in:
Pavel Bezglasny 2025-12-04 02:38:47 +01:00 • committed by GitHub
commit 81411fc12d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 195 additions and 8 deletions

View file

@ -258,6 +258,7 @@ mod tests {
mime_type: Some("text/plain".to_string()),
size: Some(100),
icons: None,
meta: None,
});
let json = serde_json::to_string(&resource_link).unwrap();

View file

@ -2,7 +2,7 @@ use base64::engine::{Engine, general_purpose::STANDARD as BASE64_STANDARD};
use serde::{Deserialize, Serialize};
use super::{
AnnotateAble, Annotations, Icon, RawEmbeddedResource, RawImageContent,
AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource, RawImageContent,
content::{EmbeddedResource, ImageContent},
resource::ResourceContents,
};
@ -25,6 +25,9 @@ pub struct Prompt {
/// Optional list of icons for the prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub icons: Option<Vec<Icon>>,
/// Optional additional metadata for this prompt
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
pub meta: Option<Meta>,
}
impl Prompt {
@ -44,6 +47,7 @@ impl Prompt {
description: description.map(Into::into),
arguments,
icons: None,
meta: None,
}
}
}

View file

@ -29,6 +29,9 @@ pub struct RawResource {
/// Optional list of icons for the resource
#[serde(skip_serializing_if = "Option::is_none")]
pub icons: Option<Vec<Icon>>,
/// Optional additional metadata for this resource
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
pub meta: Option<Meta>,
}
pub type Resource = Annotated<RawResource>;
@ -95,6 +98,7 @@ impl RawResource {
mime_type: None,
size: None,
icons: None,
meta: None,
}
}
}
@ -115,6 +119,7 @@ mod tests {
mime_type: Some("text/plain".to_string()),
size: Some(100),
icons: None,
meta: None,
};
let json = serde_json::to_string(&resource).unwrap();