Skip to content

Commit 07028bc

Browse files
authored
Add optional description field to Implementation struct (#649)
* feat: add optional description field to Implementation struct * test: update snapshots
1 parent 187597b commit 07028bc

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

crates/rmcp/src/model.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ pub struct Implementation {
841841
pub title: Option<String>,
842842
pub version: String,
843843
#[serde(skip_serializing_if = "Option::is_none")]
844+
pub description: Option<String>,
845+
#[serde(skip_serializing_if = "Option::is_none")]
844846
pub icons: Option<Vec<Icon>>,
845847
#[serde(skip_serializing_if = "Option::is_none")]
846848
pub website_url: Option<String>,
@@ -858,6 +860,7 @@ impl Implementation {
858860
name: env!("CARGO_CRATE_NAME").to_owned(),
859861
title: None,
860862
version: env!("CARGO_PKG_VERSION").to_owned(),
863+
description: None,
861864
icons: None,
862865
website_url: None,
863866
}
@@ -3136,6 +3139,7 @@ mod tests {
31363139
name: "test-server".to_string(),
31373140
title: Some("Test Server".to_string()),
31383141
version: "1.0.0".to_string(),
3142+
description: Some("A test server for unit testing".to_string()),
31393143
icons: Some(vec![
31403144
Icon {
31413145
src: "https://example.com/icon.png".to_string(),
@@ -3153,6 +3157,7 @@ mod tests {
31533157

31543158
let json = serde_json::to_value(&implementation).unwrap();
31553159
assert_eq!(json["name"], "test-server");
3160+
assert_eq!(json["description"], "A test server for unit testing");
31563161
assert_eq!(json["websiteUrl"], "https://example.com");
31573162
assert!(json["icons"].is_array());
31583163
assert_eq!(json["icons"][0]["src"], "https://example.com/icon.png");
@@ -3172,6 +3177,7 @@ mod tests {
31723177
let implementation: Implementation = serde_json::from_value(old_json).unwrap();
31733178
assert_eq!(implementation.name, "legacy-server");
31743179
assert_eq!(implementation.version, "0.9.0");
3180+
assert_eq!(implementation.description, None);
31753181
assert_eq!(implementation.icons, None);
31763182
assert_eq!(implementation.website_url, None);
31773183
}
@@ -3185,6 +3191,7 @@ mod tests {
31853191
name: "icon-server".to_string(),
31863192
title: None,
31873193
version: "2.0.0".to_string(),
3194+
description: None,
31883195
icons: Some(vec![Icon {
31893196
src: "https://example.com/server.png".to_string(),
31903197
mime_type: Some("image/png".to_string()),

crates/rmcp/tests/test_elicitation.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ async fn test_initialize_request_with_elicitation() {
11121112
name: "test-client".to_string(),
11131113
version: "1.0.0".to_string(),
11141114
title: None,
1115+
description: None,
11151116
website_url: None,
11161117
icons: None,
11171118
},
@@ -1163,6 +1164,7 @@ async fn test_capability_checking_logic() {
11631164
name: "test-client".to_string(),
11641165
version: "1.0.0".to_string(),
11651166
title: None,
1167+
description: None,
11661168
website_url: None,
11671169
icons: None,
11681170
},
@@ -1184,6 +1186,7 @@ async fn test_capability_checking_logic() {
11841186
name: "test-client".to_string(),
11851187
version: "1.0.0".to_string(),
11861188
title: None,
1189+
description: None,
11871190
website_url: None,
11881191
icons: None,
11891192
},

crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@
729729
"Implementation": {
730730
"type": "object",
731731
"properties": {
732+
"description": {
733+
"type": [
734+
"string",
735+
"null"
736+
]
737+
},
732738
"icons": {
733739
"type": [
734740
"array",

crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@
729729
"Implementation": {
730730
"type": "object",
731731
"properties": {
732+
"description": {
733+
"type": [
734+
"string",
735+
"null"
736+
]
737+
},
732738
"icons": {
733739
"type": [
734740
"array",

crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,12 @@
986986
"Implementation": {
987987
"type": "object",
988988
"properties": {
989+
"description": {
990+
"type": [
991+
"string",
992+
"null"
993+
]
994+
},
989995
"icons": {
990996
"type": [
991997
"array",

crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,12 @@
986986
"Implementation": {
987987
"type": "object",
988988
"properties": {
989+
"description": {
990+
"type": [
991+
"string",
992+
"null"
993+
]
994+
},
989995
"icons": {
990996
"type": [
991997
"array",

examples/clients/src/streamable_http.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ async fn main() -> Result<()> {
2525
name: "test sse client".to_string(),
2626
title: None,
2727
version: "0.0.1".to_string(),
28+
description: None,
2829
website_url: None,
2930
icons: None,
3031
},

0 commit comments

Comments
 (0)