Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions crates/rmcp/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3934,6 +3934,7 @@ enum ElicitRequestParamsWire {
meta: Option<RequestMetaObject>,
message: String,
url: String,
#[serde(default)]
elicitation_id: String,
},
#[serde(untagged, rename_all = "camelCase")]
Expand Down Expand Up @@ -4043,6 +4044,7 @@ pub enum ElicitRequestParams {
/// The client should direct the user to this URL to complete the elicitation.
url: String,
/// The unique identifier for this elicitation request.
/// Protocol `2026-07-28` removed this field: it is empty when absent.
elicitation_id: String,
},
}
Expand Down Expand Up @@ -6138,6 +6140,17 @@ mod tests {
assert_eq!(json_url, expected_url_json);
}

#[test]
fn test_url_elicitation_without_elicitation_id() {
let params: ElicitRequestParams = serde_json::from_value(json!({
"mode": "url",
"url": "https://mcp.example.com/ui/set_api_key",
"message": "Please provide your API key to continue."
}))
.expect("Deserialization failed");
assert_eq!(serde_json::to_value(&params).unwrap()["elicitationId"], "");
}

#[test]
fn notification_without_params_should_deserialize_as_bare_jsonrpc_message() {
let payload = b"{\"method\":\"notifications/initialized\",\"jsonrpc\":\"2.0\"}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,8 @@
]
},
"elicitationId": {
"type": "string"
"type": "string",
"default": ""
},
"message": {
"type": "string"
Expand All @@ -844,8 +845,7 @@
"required": [
"mode",
"message",
"url",
"elicitationId"
"url"
]
},
{
Expand Down
Loading