@@ -5,6 +5,7 @@ mod content;
55mod elicitation_schema;
66mod extension;
77mod meta;
8+ mod mrtr;
89mod prompt;
910mod resource;
1011mod serde_impl;
@@ -16,6 +17,7 @@ pub use content::*;
1617pub use elicitation_schema:: * ;
1718pub use extension:: * ;
1819pub use meta:: * ;
20+ pub use mrtr:: * ;
1921pub use prompt:: * ;
2022pub use resource:: * ;
2123use serde:: { Deserialize , Serialize , de:: DeserializeOwned } ;
@@ -509,6 +511,10 @@ impl ErrorCode {
509511 pub const INVALID_PARAMS : Self = Self ( -32602 ) ;
510512 pub const INTERNAL_ERROR : Self = Self ( -32603 ) ;
511513 pub const PARSE_ERROR : Self = Self ( -32700 ) ;
514+ #[ deprecated(
515+ since = "1.8.0" ,
516+ note = "URLElicitationRequiredError is removed by SEP-2322 (Multi Round-Trip Requests). Use InputRequiredResult instead."
517+ ) ]
512518 pub const URL_ELICITATION_REQUIRED : Self = Self ( -32042 ) ;
513519}
514520
@@ -565,6 +571,11 @@ impl ErrorData {
565571 pub fn internal_error ( message : impl Into < Cow < ' static , str > > , data : Option < Value > ) -> Self {
566572 Self :: new ( ErrorCode :: INTERNAL_ERROR , message, data)
567573 }
574+ #[ deprecated(
575+ since = "1.8.0" ,
576+ note = "URLElicitationRequiredError is removed by SEP-2322 (Multi Round-Trip Requests). Use InputRequiredResult instead."
577+ ) ]
578+ #[ allow( deprecated) ]
568579 pub fn url_elicitation_required (
569580 message : impl Into < Cow < ' static , str > > ,
570581 data : Option < Value > ,
@@ -1212,6 +1223,13 @@ pub struct ReadResourceRequestParams {
12121223 pub meta : Option < Meta > ,
12131224 /// The URI of the resource to read
12141225 pub uri : String ,
1226+ /// Client responses to server-initiated input requests from a previous
1227+ /// `InputRequiredResult` (SEP-2322 Multi Round-Trip Requests).
1228+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1229+ pub input_responses : Option < InputResponses > ,
1230+ /// Opaque request state echoed back from a previous `InputRequiredResult` (SEP-2322).
1231+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1232+ pub request_state : Option < String > ,
12151233}
12161234
12171235impl ReadResourceRequestParams {
@@ -1220,6 +1238,8 @@ impl ReadResourceRequestParams {
12201238 Self {
12211239 meta : None ,
12221240 uri : uri. into ( ) ,
1241+ input_responses : None ,
1242+ request_state : None ,
12231243 }
12241244 }
12251245
@@ -1228,6 +1248,18 @@ impl ReadResourceRequestParams {
12281248 self . meta = Some ( meta) ;
12291249 self
12301250 }
1251+
1252+ /// Sets the input responses for an MRTR retry (SEP-2322).
1253+ pub fn with_input_responses ( mut self , input_responses : InputResponses ) -> Self {
1254+ self . input_responses = Some ( input_responses) ;
1255+ self
1256+ }
1257+
1258+ /// Sets the request state for an MRTR retry (SEP-2322).
1259+ pub fn with_request_state ( mut self , request_state : impl Into < String > ) -> Self {
1260+ self . request_state = Some ( request_state. into ( ) ) ;
1261+ self
1262+ }
12311263}
12321264
12331265impl RequestParamsMeta for ReadResourceRequestParams {
@@ -1395,6 +1427,13 @@ pub struct GetPromptRequestParams {
13951427 pub name : String ,
13961428 #[ serde( skip_serializing_if = "Option::is_none" ) ]
13971429 pub arguments : Option < JsonObject > ,
1430+ /// Client responses to server-initiated input requests from a previous
1431+ /// `InputRequiredResult` (SEP-2322 Multi Round-Trip Requests).
1432+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1433+ pub input_responses : Option < InputResponses > ,
1434+ /// Opaque request state echoed back from a previous `InputRequiredResult` (SEP-2322).
1435+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1436+ pub request_state : Option < String > ,
13981437}
13991438
14001439impl GetPromptRequestParams {
@@ -1404,6 +1443,8 @@ impl GetPromptRequestParams {
14041443 meta : None ,
14051444 name : name. into ( ) ,
14061445 arguments : None ,
1446+ input_responses : None ,
1447+ request_state : None ,
14071448 }
14081449 }
14091450
@@ -1418,6 +1459,18 @@ impl GetPromptRequestParams {
14181459 self . meta = Some ( meta) ;
14191460 self
14201461 }
1462+
1463+ /// Sets the input responses for an MRTR retry (SEP-2322).
1464+ pub fn with_input_responses ( mut self , input_responses : InputResponses ) -> Self {
1465+ self . input_responses = Some ( input_responses) ;
1466+ self
1467+ }
1468+
1469+ /// Sets the request state for an MRTR retry (SEP-2322).
1470+ pub fn with_request_state ( mut self , request_state : impl Into < String > ) -> Self {
1471+ self . request_state = Some ( request_state. into ( ) ) ;
1472+ self
1473+ }
14211474}
14221475
14231476impl RequestParamsMeta for GetPromptRequestParams {
@@ -3019,6 +3072,17 @@ pub struct CallToolRequestParams {
30193072 /// Task metadata for async task management (SEP-1319)
30203073 #[ serde( skip_serializing_if = "Option::is_none" ) ]
30213074 pub task : Option < JsonObject > ,
3075+ /// Client responses to server-initiated input requests from a previous
3076+ /// `InputRequiredResult`. Present only when retrying after an incomplete result.
3077+ /// (SEP-2322 Multi Round-Trip Requests)
3078+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
3079+ pub input_responses : Option < InputResponses > ,
3080+ /// Opaque request state echoed back from a previous `InputRequiredResult`.
3081+ /// Clients MUST return this value exactly as received. Present only when
3082+ /// retrying a request after receiving an incomplete result that included
3083+ /// a `requestState` field. (SEP-2322)
3084+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
3085+ pub request_state : Option < String > ,
30223086}
30233087
30243088impl CallToolRequestParams {
@@ -3029,6 +3093,8 @@ impl CallToolRequestParams {
30293093 name : name. into ( ) ,
30303094 arguments : None ,
30313095 task : None ,
3096+ input_responses : None ,
3097+ request_state : None ,
30323098 }
30333099 }
30343100
@@ -3043,6 +3109,18 @@ impl CallToolRequestParams {
30433109 self . task = Some ( task) ;
30443110 self
30453111 }
3112+
3113+ /// Sets the input responses for an MRTR retry (SEP-2322).
3114+ pub fn with_input_responses ( mut self , input_responses : InputResponses ) -> Self {
3115+ self . input_responses = Some ( input_responses) ;
3116+ self
3117+ }
3118+
3119+ /// Sets the request state for an MRTR retry (SEP-2322).
3120+ pub fn with_request_state ( mut self , request_state : impl Into < String > ) -> Self {
3121+ self . request_state = Some ( request_state. into ( ) ) ;
3122+ self
3123+ }
30463124}
30473125
30483126impl RequestParamsMeta for CallToolRequestParams {
@@ -3431,6 +3509,7 @@ ts_union!(
34313509 | GetTaskResult
34323510 | CancelTaskResult
34333511 | CallToolResult
3512+ | InputRequiredResult
34343513 | GetTaskPayloadResult
34353514 | EmptyResult
34363515 | CustomResult
0 commit comments