@@ -3,7 +3,7 @@ use rust_mcp_schema::{
33 ElicitRequestFormParams , ElicitRequestParams , ElicitRequestUrlParams , ElicitResultContent ,
44 RpcError ,
55} ;
6- use std:: collections:: HashMap ;
6+ use std:: collections:: BTreeMap ;
77
88#[ test]
99fn test_form_basic_conversion ( ) {
@@ -16,7 +16,7 @@ fn test_form_basic_conversion() {
1616 pub expertise : Vec < String > ,
1717 }
1818 assert_eq ! ( BasicUser :: message( ) , "Please enter your name and age" ) ;
19- let mut content: std:: collections:: HashMap < String , ElicitResultContent > = HashMap :: new ( ) ;
19+ let mut content: std:: collections:: BTreeMap < String , ElicitResultContent > = BTreeMap :: new ( ) ;
2020 content. insert (
2121 "name" . to_string ( ) ,
2222 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -67,7 +67,7 @@ fn test_url_basic_conversion() {
6767 "https://github.com/rust-mcp-stack/rust-mcp-sdk"
6868 ) ;
6969
70- let mut content: std:: collections:: HashMap < String , ElicitResultContent > = HashMap :: new ( ) ;
70+ let mut content: std:: collections:: BTreeMap < String , ElicitResultContent > = BTreeMap :: new ( ) ;
7171 content. insert (
7272 "name" . to_string ( ) ,
7373 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -109,7 +109,7 @@ fn test_missing_required_field_returns_error() {
109109 pub tags : Vec < String > ,
110110 }
111111
112- let mut content = HashMap :: new ( ) ;
112+ let mut content = BTreeMap :: new ( ) ;
113113 content. insert (
114114 "name" . to_string ( ) ,
115115 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -130,7 +130,7 @@ fn test_extra_unknown_field_is_ignored() {
130130 pub name : String ,
131131 }
132132
133- let mut content = HashMap :: new ( ) ;
133+ let mut content = BTreeMap :: new ( ) ;
134134 content. insert (
135135 "name" . to_string ( ) ,
136136 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -158,7 +158,7 @@ fn test_type_mismatch_returns_error() {
158158 pub active : bool ,
159159 }
160160
161- let mut content = HashMap :: new ( ) ;
161+ let mut content = BTreeMap :: new ( ) ;
162162 content. insert (
163163 "age" . to_string ( ) ,
164164 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -183,7 +183,7 @@ fn test_empty_string_array_when_missing_optional_vec() {
183183 pub hobbies : Option < Vec < String > > ,
184184 }
185185
186- let mut content = HashMap :: new ( ) ;
186+ let mut content = BTreeMap :: new ( ) ;
187187 content. insert (
188188 "name" . to_string ( ) ,
189189 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -210,7 +210,7 @@ fn test_empty_content_map_becomes_default_values() {
210210 let result = WithOptionals :: from_elicit_result_content ( None ) ;
211211 assert ! ( result. is_err( ) ) ;
212212
213- let result_empty = WithOptionals :: from_elicit_result_content ( Some ( HashMap :: new ( ) ) ) ;
213+ let result_empty = WithOptionals :: from_elicit_result_content ( Some ( BTreeMap :: new ( ) ) ) ;
214214 assert ! ( result_empty. is_err( ) ) ;
215215}
216216
@@ -223,7 +223,7 @@ fn test_boolean_handling() {
223223 pub has_permission : Option < bool > ,
224224 }
225225
226- let mut content = HashMap :: new ( ) ;
226+ let mut content = BTreeMap :: new ( ) ;
227227 content. insert (
228228 "is_active" . to_string ( ) ,
229229 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: Boolean (
@@ -251,7 +251,7 @@ fn test_numeric_types_variations() {
251251 pub ratio : Option < i32 > ,
252252 }
253253
254- let mut content = HashMap :: new ( ) ;
254+ let mut content = BTreeMap :: new ( ) ;
255255 content. insert (
256256 "count" . to_string ( ) ,
257257 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: Integer ( 42 ) ) ,
@@ -298,7 +298,7 @@ fn test_form_and_url_share_same_from_elicit_result_content_logic() {
298298 pub x : String ,
299299 }
300300
301- let mut content = HashMap :: new ( ) ;
301+ let mut content = BTreeMap :: new ( ) ;
302302 content. insert (
303303 "x" . to_string ( ) ,
304304 ElicitResultContent :: Primitive ( rust_mcp_schema:: ElicitResultContentPrimitive :: String (
@@ -321,7 +321,7 @@ fn test_string_array_empty_input_becomes_empty_vec() {
321321 pub items : Vec < String > ,
322322 }
323323
324- let mut content = HashMap :: new ( ) ;
324+ let mut content = BTreeMap :: new ( ) ;
325325 content. insert (
326326 "items" . to_string ( ) ,
327327 ElicitResultContent :: StringArray ( vec ! [ ] ) ,
@@ -335,7 +335,7 @@ fn test_string_array_empty_input_becomes_empty_vec() {
335335fn readme_example_elicitation ( ) {
336336 use rust_mcp_macros:: { mcp_elicit, JsonSchema } ;
337337 use rust_mcp_schema:: { ElicitRequestParams , ElicitResultContent } ;
338- use std:: collections:: HashMap ;
338+ use std:: collections:: BTreeMap ;
339339
340340 #[ mcp_elicit( message = "Please enter your info" , mode = form) ]
341341 #[ derive( JsonSchema ) ]
@@ -356,7 +356,7 @@ fn readme_example_elicitation() {
356356 }
357357
358358 // Simulate user input
359- let mut content: HashMap < String , ElicitResultContent > = HashMap :: new ( ) ;
359+ let mut content: BTreeMap < String , ElicitResultContent > = BTreeMap :: new ( ) ;
360360 content. insert ( "name" . to_string ( ) , "Alice" . into ( ) ) ;
361361 content. insert ( "email" . to_string ( ) , "alice@Borderland.com" . into ( ) ) ;
362362 content. insert ( "age" . to_string ( ) , 25 . into ( ) ) ;
@@ -389,7 +389,7 @@ fn readme_example_elicitation_url() {
389389 assert_eq ! ( elicit_url. message, "Complete the form" ) ;
390390
391391 // Simulate user input
392- let mut content: HashMap < String , ElicitResultContent > = HashMap :: new ( ) ;
392+ let mut content: BTreeMap < String , ElicitResultContent > = BTreeMap :: new ( ) ;
393393 content. insert ( "name" . to_string ( ) , "Alice" . into ( ) ) ;
394394 content. insert ( "email" . to_string ( ) , "alice@Borderland.com" . into ( ) ) ;
395395 content. insert ( "age" . to_string ( ) , 25 . into ( ) ) ;
0 commit comments