feat(SEP-973): add support for icons and websiteUrl across relevant types (#432)
This commit is contained in:
parent
6fbd941a32
commit
b57aa47693
4 changed files with 611 additions and 63 deletions
|
|
@ -257,6 +257,7 @@ mod tests {
|
|||
description: Some("A test file".to_string()),
|
||||
mime_type: Some("text/plain".to_string()),
|
||||
size: Some(100),
|
||||
icons: None,
|
||||
});
|
||||
|
||||
let json = serde_json::to_string(&resource_link).unwrap();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use base64::engine::{Engine, general_purpose::STANDARD as BASE64_STANDARD};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{
|
||||
AnnotateAble, Annotations, RawEmbeddedResource, RawImageContent,
|
||||
AnnotateAble, Annotations, Icon, RawEmbeddedResource, RawImageContent,
|
||||
content::{EmbeddedResource, ImageContent},
|
||||
resource::ResourceContents,
|
||||
};
|
||||
|
|
@ -22,6 +22,9 @@ pub struct Prompt {
|
|||
/// Optional arguments that can be passed to customize the prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub arguments: Option<Vec<PromptArgument>>,
|
||||
/// Optional list of icons for the prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub icons: Option<Vec<Icon>>,
|
||||
}
|
||||
|
||||
impl Prompt {
|
||||
|
|
@ -40,6 +43,7 @@ impl Prompt {
|
|||
title: None,
|
||||
description: description.map(Into::into),
|
||||
arguments,
|
||||
icons: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use schemars::JsonSchema;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use super::JsonObject;
|
||||
use super::{Icon, JsonObject};
|
||||
|
||||
/// A tool that can be used by a model.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -29,6 +29,9 @@ pub struct Tool {
|
|||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// Optional additional tool information.
|
||||
pub annotations: Option<ToolAnnotations>,
|
||||
/// Optional list of icons for the tool
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub icons: Option<Vec<Icon>>,
|
||||
}
|
||||
|
||||
/// Additional properties describing a Tool to clients.
|
||||
|
|
@ -146,6 +149,7 @@ impl Tool {
|
|||
input_schema: input_schema.into(),
|
||||
output_schema: None,
|
||||
annotations: None,
|
||||
icons: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue