@@ -44,19 +44,19 @@ impl SimpleMcpClient {
4444
4545 // Simulate connecting to an MCP server
4646 pub async fn connect ( & self ) -> Result < ( ) , String > {
47- println ! ( "🔗 Connecting to MCP server: {}" , self . server_url) ;
47+ eprintln ! ( "🔗 Connecting to MCP server: {}" , self . server_url) ;
4848
4949 // In a real implementation, this would establish a connection
5050 // For this demo, we'll just simulate success
5151 tokio:: time:: sleep ( std:: time:: Duration :: from_millis ( 100 ) ) . await ;
5252
53- println ! ( "✅ Connected successfully!" ) ;
53+ eprintln ! ( "✅ Connected successfully!" ) ;
5454 Ok ( ( ) )
5555 }
5656
5757 // Simulate listing available tools from the server
5858 pub async fn list_tools ( & self ) -> Result < Vec < ToolInfo > , String > {
59- println ! ( "🔍 Discovering available tools..." ) ;
59+ eprintln ! ( "🔍 Discovering available tools..." ) ;
6060
6161 // Simulate network delay
6262 tokio:: time:: sleep ( std:: time:: Duration :: from_millis ( 50 ) ) . await ;
@@ -101,17 +101,17 @@ impl SimpleMcpClient {
101101 } ,
102102 ] ;
103103
104- println ! ( "📋 Found {} tools" , tools. len( ) ) ;
104+ eprintln ! ( "📋 Found {} tools" , tools. len( ) ) ;
105105 for tool in & tools {
106- println ! ( " - {}: {}" , tool. name, tool. description) ;
106+ eprintln ! ( " - {}: {}" , tool. name, tool. description) ;
107107 }
108108
109109 Ok ( tools)
110110 }
111111
112112 // Simulate calling a tool on the server
113113 pub async fn call_tool ( & self , request : ToolCallRequest ) -> Result < ToolCallResponse , String > {
114- println ! ( "🔧 Calling tool: {}" , request. tool_name) ;
114+ eprintln ! ( "🔧 Calling tool: {}" , request. tool_name) ;
115115
116116 // Simulate network delay
117117 tokio:: time:: sleep ( std:: time:: Duration :: from_millis ( 100 ) ) . await ;
@@ -216,8 +216,8 @@ impl SimpleMcpClient {
216216
217217 // Demonstrate a complete client workflow
218218 pub async fn demonstrate_client_workflow ( & self ) -> Result < ( ) , String > {
219- println ! ( "🚀 Starting MCP Client Demonstration" ) ;
220- println ! ( "====================================" ) ;
219+ eprintln ! ( "🚀 Starting MCP Client Demonstration" ) ;
220+ eprintln ! ( "====================================" ) ;
221221
222222 // Step 1: Connect to server
223223 self . connect ( ) . await ?;
@@ -226,7 +226,7 @@ impl SimpleMcpClient {
226226 let tools = self . list_tools ( ) . await ?;
227227
228228 // Step 3: Call each tool with sample data
229- println ! ( "\n 🧪 Testing tools with sample data:" ) ;
229+ eprintln ! ( "\n 🧪 Testing tools with sample data:" ) ;
230230
231231 // Test greeting tool
232232 if tools. iter ( ) . any ( |t| t. name == "greeting" ) {
@@ -241,16 +241,16 @@ impl SimpleMcpClient {
241241 result : Some ( result) ,
242242 ..
243243 } => {
244- println ! ( "✅ Greeting result: {}" , result) ;
244+ eprintln ! ( "✅ Greeting result: {}" , result) ;
245245 }
246246 ToolCallResponse {
247247 success : false ,
248248 error : Some ( err) ,
249249 ..
250250 } => {
251- println ! ( "❌ Greeting failed: {}" , err) ;
251+ eprintln ! ( "❌ Greeting failed: {}" , err) ;
252252 }
253- _ => println ! ( "⚠️ Unexpected greeting response" ) ,
253+ _ => eprintln ! ( "⚠️ Unexpected greeting response" ) ,
254254 }
255255 }
256256
@@ -271,16 +271,16 @@ impl SimpleMcpClient {
271271 result : Some ( result) ,
272272 ..
273273 } => {
274- println ! ( "✅ Calculator result: {}" , result) ;
274+ eprintln ! ( "✅ Calculator result: {}" , result) ;
275275 }
276276 ToolCallResponse {
277277 success : false ,
278278 error : Some ( err) ,
279279 ..
280280 } => {
281- println ! ( "❌ Calculator failed: {}" , err) ;
281+ eprintln ! ( "❌ Calculator failed: {}" , err) ;
282282 }
283- _ => println ! ( "⚠️ Unexpected calculator response" ) ,
283+ _ => eprintln ! ( "⚠️ Unexpected calculator response" ) ,
284284 }
285285 }
286286
@@ -300,20 +300,20 @@ impl SimpleMcpClient {
300300 result : Some ( result) ,
301301 ..
302302 } => {
303- println ! ( "✅ Text transform result: {}" , result) ;
303+ eprintln ! ( "✅ Text transform result: {}" , result) ;
304304 }
305305 ToolCallResponse {
306306 success : false ,
307307 error : Some ( err) ,
308308 ..
309309 } => {
310- println ! ( "❌ Text transform failed: {}" , err) ;
310+ eprintln ! ( "❌ Text transform failed: {}" , err) ;
311311 }
312- _ => println ! ( "⚠️ Unexpected text transform response" ) ,
312+ _ => eprintln ! ( "⚠️ Unexpected text transform response" ) ,
313313 }
314314 }
315315
316- println ! ( "\n 🎉 Client demonstration completed successfully!" ) ;
316+ eprintln ! ( "\n 🎉 Client demonstration completed successfully!" ) ;
317317 Ok ( ( ) )
318318 }
319319}
0 commit comments