@@ -5,8 +5,7 @@ use rmcp::{
55 model:: * ,
66 service:: RequestContext ,
77 transport:: {
8- AuthClient , AuthorizationManager , StreamableHttpClientTransport ,
9- auth:: { OAuthClientConfig , OAuthState } ,
8+ AuthClient , AuthorizationManager , StreamableHttpClientTransport , auth:: OAuthState ,
109 streamable_http_client:: StreamableHttpClientTransportConfig ,
1110 } ,
1211} ;
@@ -17,9 +16,6 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
1716
1817#[ derive( Debug , Default , serde:: Deserialize ) ]
1918struct ConformanceContext {
20- #[ serde( default ) ]
21- name : Option < String > ,
22- // pre-registration / client-credentials-basic
2319 #[ serde( default ) ]
2420 client_id : Option < String > ,
2521 #[ serde( default ) ]
@@ -29,15 +25,6 @@ struct ConformanceContext {
2925 private_key_pem : Option < String > ,
3026 #[ serde( default ) ]
3127 signing_algorithm : Option < String > ,
32- // cross-app-access
33- #[ serde( default ) ]
34- idp_client_id : Option < String > ,
35- #[ serde( default ) ]
36- idp_id_token : Option < String > ,
37- #[ serde( default ) ]
38- idp_issuer : Option < String > ,
39- #[ serde( default ) ]
40- idp_token_endpoint : Option < String > ,
4128}
4229
4330fn load_context ( ) -> ConformanceContext {
@@ -175,17 +162,17 @@ impl ClientHandler for FullClientHandler {
175162 . and_then ( |c| c. as_text ( ) )
176163 . map ( |t| t. text . clone ( ) )
177164 . unwrap_or_default ( ) ;
178- Ok ( CreateMessageResult {
179- message : SamplingMessage :: new (
165+ Ok ( CreateMessageResult :: new (
166+ SamplingMessage :: new (
180167 Role :: Assistant ,
181168 SamplingMessageContent :: text ( format ! (
182169 "This is a mock LLM response to: {}" ,
183170 prompt_text
184171 ) ) ,
185172 ) ,
186- model : "mock-model" . into ( ) ,
187- stop_reason : Some ( "endTurn" . into ( ) ) ,
188- } )
173+ "mock-model" . into ( ) ,
174+ )
175+ . with_stop_reason ( "endTurn" ) )
189176 }
190177 }
191178
@@ -216,7 +203,7 @@ const REDIRECT_URI: &str = "http://localhost:3000/callback";
216203/// 4. Return an `AuthClient` wrapping `reqwest::Client`
217204async fn perform_oauth_flow (
218205 server_url : & str ,
219- ctx : & ConformanceContext ,
206+ _ctx : & ConformanceContext ,
220207) -> anyhow:: Result < AuthClient < reqwest:: Client > > {
221208 let mut oauth = OAuthState :: new ( server_url, None ) . await ?;
222209
@@ -335,12 +322,7 @@ async fn run_auth_client(server_url: &str, ctx: &ConformanceContext) -> anyhow::
335322 for tool in & tools. tools {
336323 let args = build_tool_arguments ( tool) ;
337324 let _ = client
338- . call_tool ( CallToolRequestParams {
339- meta : None ,
340- name : tool. name . clone ( ) ,
341- arguments : args,
342- task : None ,
343- } )
325+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
344326 . await ;
345327 }
346328
@@ -352,7 +334,7 @@ async fn run_auth_client(server_url: &str, ctx: &ConformanceContext) -> anyhow::
352334/// then call tool which triggers 403 → re-auth with expanded scopes → retry.
353335async fn run_auth_scope_step_up_client (
354336 server_url : & str ,
355- ctx : & ConformanceContext ,
337+ _ctx : & ConformanceContext ,
356338) -> anyhow:: Result < ( ) > {
357339 // First auth
358340 let mut oauth = OAuthState :: new ( server_url, None ) . await ?;
@@ -388,12 +370,7 @@ async fn run_auth_scope_step_up_client(
388370 for tool in & tools. tools {
389371 let args = build_tool_arguments ( tool) ;
390372 match client
391- . call_tool ( CallToolRequestParams {
392- meta : None ,
393- name : tool. name . clone ( ) ,
394- arguments : args. clone ( ) ,
395- task : None ,
396- } )
373+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args. clone ( ) ) )
397374 . await
398375 {
399376 Ok ( _) => {
@@ -428,12 +405,7 @@ async fn run_auth_scope_step_up_client(
428405 ) ;
429406 let client2 = BasicClientHandler . serve ( transport2) . await ?;
430407 let _ = client2
431- . call_tool ( CallToolRequestParams {
432- meta : None ,
433- name : tool. name . clone ( ) ,
434- arguments : args,
435- task : None ,
436- } )
408+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
437409 . await ;
438410 client2. cancel ( ) . await . ok ( ) ;
439411 return Ok ( ( ) ) ;
@@ -481,12 +453,7 @@ async fn run_auth_scope_retry_limit_client(
481453 for tool in & tools. tools {
482454 let args = build_tool_arguments ( tool) ;
483455 match client
484- . call_tool ( CallToolRequestParams {
485- meta : None ,
486- name : tool. name . clone ( ) ,
487- arguments : args,
488- task : None ,
489- } )
456+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
490457 . await
491458 {
492459 Ok ( _) => { }
@@ -539,12 +506,7 @@ async fn run_auth_preregistered_client(
539506 for tool in & tools. tools {
540507 let args = build_tool_arguments ( tool) ;
541508 let _ = client
542- . call_tool ( CallToolRequestParams {
543- meta : None ,
544- name : tool. name . clone ( ) ,
545- arguments : args,
546- task : None ,
547- } )
509+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
548510 . await ;
549511 }
550512 client. cancel ( ) . await ?;
@@ -597,12 +559,7 @@ async fn run_client_credentials_basic(
597559 for tool in & tools. tools {
598560 let args = build_tool_arguments ( tool) ;
599561 let _ = client
600- . call_tool ( CallToolRequestParams {
601- meta : None ,
602- name : tool. name . clone ( ) ,
603- arguments : args,
604- task : None ,
605- } )
562+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
606563 . await ;
607564 }
608565 client. cancel ( ) . await ?;
@@ -667,12 +624,7 @@ async fn run_client_credentials_jwt(
667624 for tool in & tools. tools {
668625 let args = build_tool_arguments ( tool) ;
669626 let _ = client
670- . call_tool ( CallToolRequestParams {
671- meta : None ,
672- name : tool. name . clone ( ) ,
673- arguments : args,
674- task : None ,
675- } )
627+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
676628 . await ;
677629 }
678630 client. cancel ( ) . await ?;
@@ -783,6 +735,18 @@ async fn headless_authorize(auth_url: &str) -> anyhow::Result<(String, String)>
783735 Ok ( ( code, state) )
784736}
785737
738+ /// Build a `CallToolRequestParams` for a tool, optionally with arguments.
739+ fn call_tool_params (
740+ name : std:: borrow:: Cow < ' static , str > ,
741+ arguments : Option < serde_json:: Map < String , Value > > ,
742+ ) -> CallToolRequestParams {
743+ let mut p = CallToolRequestParams :: new ( name) ;
744+ if let Some ( a) = arguments {
745+ p = p. with_arguments ( a) ;
746+ }
747+ p
748+ }
749+
786750/// Build arguments for a tool based on its input schema.
787751fn build_tool_arguments ( tool : & Tool ) -> Option < serde_json:: Map < String , Value > > {
788752 let schema = & tool. input_schema ;
@@ -840,12 +804,7 @@ async fn run_tools_call_client(server_url: &str) -> anyhow::Result<()> {
840804 for tool in & tools. tools {
841805 let args = build_tool_arguments ( tool) ;
842806 let _ = client
843- . call_tool ( CallToolRequestParams {
844- meta : None ,
845- name : tool. name . clone ( ) ,
846- arguments : args,
847- task : None ,
848- } )
807+ . call_tool ( call_tool_params ( tool. name . clone ( ) , args) )
849808 . await ?;
850809 }
851810 client. cancel ( ) . await ?;
@@ -862,12 +821,7 @@ async fn run_elicitation_defaults_client(server_url: &str) -> anyhow::Result<()>
862821 } ) ;
863822 if let Some ( tool) = test_tool {
864823 let _ = client
865- . call_tool ( CallToolRequestParams {
866- meta : None ,
867- name : tool. name . clone ( ) ,
868- arguments : None ,
869- task : None ,
870- } )
824+ . call_tool ( call_tool_params ( tool. name . clone ( ) , None ) )
871825 . await ?;
872826 }
873827 client. cancel ( ) . await ?;
@@ -884,12 +838,7 @@ async fn run_sse_retry_client(server_url: &str) -> anyhow::Result<()> {
884838 . find ( |t| t. name . as_ref ( ) == "test_reconnection" )
885839 {
886840 let _ = client
887- . call_tool ( CallToolRequestParams {
888- meta : None ,
889- name : tool. name . clone ( ) ,
890- arguments : None ,
891- task : None ,
892- } )
841+ . call_tool ( call_tool_params ( tool. name . clone ( ) , None ) )
893842 . await ?;
894843 }
895844 client. cancel ( ) . await ?;
0 commit comments