Skip to content

Commit 589815a

Browse files
authored
fix: correct numeric types in progress notifications (#361)
* fix: correct numeric types in progress notifications The standard specifies that these may be floating-point. * fix: regenerate schemas
1 parent 6a97503 commit 589815a

File tree

5 files changed

+16
-22
lines changed

5 files changed

+16
-22
lines changed

crates/rmcp/src/model.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,10 @@ const_string!(ProgressNotificationMethod = "notifications/progress");
758758
pub struct ProgressNotificationParam {
759759
pub progress_token: ProgressToken,
760760
/// The progress thus far. This should increase every time progress is made, even if the total is unknown.
761-
pub progress: u32,
761+
pub progress: f64,
762762
/// Total number of items to process (or total progress required), if known
763763
#[serde(skip_serializing_if = "Option::is_none")]
764-
pub total: Option<u32>,
764+
pub total: Option<f64>,
765765
/// An optional message describing the current progress.
766766
#[serde(skip_serializing_if = "Option::is_none")]
767767
pub message: Option<String>,

crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,21 +762,19 @@
762762
},
763763
"progress": {
764764
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
765-
"type": "integer",
766-
"format": "uint32",
767-
"minimum": 0
765+
"type": "number",
766+
"format": "double"
768767
},
769768
"progressToken": {
770769
"$ref": "#/definitions/ProgressToken"
771770
},
772771
"total": {
773772
"description": "Total number of items to process (or total progress required), if known",
774773
"type": [
775-
"integer",
774+
"number",
776775
"null"
777776
],
778-
"format": "uint32",
779-
"minimum": 0
777+
"format": "double"
780778
}
781779
},
782780
"required": [

crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,21 +1027,19 @@
10271027
},
10281028
"progress": {
10291029
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
1030-
"type": "integer",
1031-
"format": "uint32",
1032-
"minimum": 0
1030+
"type": "number",
1031+
"format": "double"
10331032
},
10341033
"progressToken": {
10351034
"$ref": "#/definitions/ProgressToken"
10361035
},
10371036
"total": {
10381037
"description": "Total number of items to process (or total progress required), if known",
10391038
"type": [
1040-
"integer",
1039+
"number",
10411040
"null"
10421041
],
1043-
"format": "uint32",
1044-
"minimum": 0
1042+
"format": "double"
10451043
}
10461044
},
10471045
"required": [

crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,21 +1027,19 @@
10271027
},
10281028
"progress": {
10291029
"description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.",
1030-
"type": "integer",
1031-
"format": "uint32",
1032-
"minimum": 0
1030+
"type": "number",
1031+
"format": "double"
10331032
},
10341033
"progressToken": {
10351034
"$ref": "#/definitions/ProgressToken"
10361035
},
10371036
"total": {
10381037
"description": "Total number of items to process (or total progress required), if known",
10391038
"type": [
1040-
"integer",
1039+
"number",
10411040
"null"
10421041
],
1043-
"format": "uint32",
1044-
"minimum": 0
1042+
"format": "double"
10451043
}
10461044
},
10471045
"required": [

crates/rmcp/tests/test_progress_subscriber.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl MyServer {
6969
let _ = client
7070
.notify_progress(ProgressNotificationParam {
7171
progress_token: progress_token.clone(),
72-
progress: step,
73-
total: Some(10),
72+
progress: (step as f64),
73+
total: Some(10.0),
7474
message: Some("Some message".into()),
7575
})
7676
.await;

0 commit comments

Comments
 (0)