Add optional description field to Implementation struct (#649)

* feat: add optional description field to Implementation struct

* test: update snapshots
This commit is contained in:
Dale Seo 2026-02-10 08:36:47 -05:00 committed by GitHub
parent 187597bf7e
commit 07028bc0aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 35 additions and 0 deletions

View file

@ -841,6 +841,8 @@ pub struct Implementation {
pub title: Option<String>,
pub version: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub icons: Option<Vec<Icon>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub website_url: Option<String>,
@ -858,6 +860,7 @@ impl Implementation {
name: env!("CARGO_CRATE_NAME").to_owned(),
title: None,
version: env!("CARGO_PKG_VERSION").to_owned(),
description: None,
icons: None,
website_url: None,
}
@ -3136,6 +3139,7 @@ mod tests {
name: "test-server".to_string(),
title: Some("Test Server".to_string()),
version: "1.0.0".to_string(),
description: Some("A test server for unit testing".to_string()),
icons: Some(vec![
Icon {
src: "https://example.com/icon.png".to_string(),
@ -3153,6 +3157,7 @@ mod tests {
let json = serde_json::to_value(&implementation).unwrap();
assert_eq!(json["name"], "test-server");
assert_eq!(json["description"], "A test server for unit testing");
assert_eq!(json["websiteUrl"], "https://example.com");
assert!(json["icons"].is_array());
assert_eq!(json["icons"][0]["src"], "https://example.com/icon.png");
@ -3172,6 +3177,7 @@ mod tests {
let implementation: Implementation = serde_json::from_value(old_json).unwrap();
assert_eq!(implementation.name, "legacy-server");
assert_eq!(implementation.version, "0.9.0");
assert_eq!(implementation.description, None);
assert_eq!(implementation.icons, None);
assert_eq!(implementation.website_url, None);
}
@ -3185,6 +3191,7 @@ mod tests {
name: "icon-server".to_string(),
title: None,
version: "2.0.0".to_string(),
description: None,
icons: Some(vec![Icon {
src: "https://example.com/server.png".to_string(),
mime_type: Some("image/png".to_string()),

View file

@ -1112,6 +1112,7 @@ async fn test_initialize_request_with_elicitation() {
name: "test-client".to_string(),
version: "1.0.0".to_string(),
title: None,
description: None,
website_url: None,
icons: None,
},
@ -1163,6 +1164,7 @@ async fn test_capability_checking_logic() {
name: "test-client".to_string(),
version: "1.0.0".to_string(),
title: None,
description: None,
website_url: None,
icons: None,
},
@ -1184,6 +1186,7 @@ async fn test_capability_checking_logic() {
name: "test-client".to_string(),
version: "1.0.0".to_string(),
title: None,
description: None,
website_url: None,
icons: None,
},

View file

@ -729,6 +729,12 @@
"Implementation": {
"type": "object",
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"type": [
"array",

View file

@ -729,6 +729,12 @@
"Implementation": {
"type": "object",
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"type": [
"array",

View file

@ -986,6 +986,12 @@
"Implementation": {
"type": "object",
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"type": [
"array",

View file

@ -986,6 +986,12 @@
"Implementation": {
"type": "object",
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"icons": {
"type": [
"array",

View file

@ -25,6 +25,7 @@ async fn main() -> Result<()> {
name: "test sse client".to_string(),
title: None,
version: "0.0.1".to_string(),
description: None,
website_url: None,
icons: None,
},