@@ -115,27 +115,23 @@ public static async IAsyncEnumerable<McpClientTool> EnumerateToolsAsync(
115115 /// <param name="client">The client.</param>
116116 /// <param name="cancellationToken">A token to cancel the operation.</param>
117117 /// <returns>A list of all available prompts.</returns>
118- public static async Task < IList < Prompt > > ListPromptsAsync (
118+ public static async Task < IList < McpClientPrompt > > ListPromptsAsync (
119119 this IMcpClient client , CancellationToken cancellationToken = default )
120120 {
121121 Throw . IfNull ( client ) ;
122122
123- List < Prompt > ? prompts = null ;
124-
123+ List < McpClientPrompt > ? prompts = null ;
125124 string ? cursor = null ;
126125 do
127126 {
128127 var promptResults = await client . SendRequestAsync < ListPromptsResult > (
129128 CreateRequest ( RequestMethods . PromptsList , CreateCursorDictionary ( cursor ) ) ,
130129 cancellationToken ) . ConfigureAwait ( false ) ;
131130
132- if ( prompts is null )
133- {
134- prompts = promptResults . Prompts ;
135- }
136- else
131+ prompts ??= new List < McpClientPrompt > ( promptResults . Prompts . Count ) ;
132+ foreach ( var prompt in promptResults . Prompts )
137133 {
138- prompts . AddRange ( promptResults . Prompts ) ;
134+ prompts . Add ( new McpClientPrompt ( client , prompt ) ) ;
139135 }
140136
141137 cursor = promptResults . NextCursor ;
@@ -186,7 +182,7 @@ public static async IAsyncEnumerable<Prompt> EnumeratePromptsAsync(
186182 /// <param name="cancellationToken">A token to cancel the operation.</param>
187183 /// <returns>A task containing the prompt's content and messages.</returns>
188184 public static Task < GetPromptResult > GetPromptAsync (
189- this IMcpClient client , string name , Dictionary < string , object ? > ? arguments = null , CancellationToken cancellationToken = default )
185+ this IMcpClient client , string name , IReadOnlyDictionary < string , object ? > ? arguments = null , CancellationToken cancellationToken = default )
190186 {
191187 Throw . IfNull ( client ) ;
192188 Throw . IfNullOrWhiteSpace ( name ) ;
@@ -345,7 +341,7 @@ public static Task<ReadResourceResult> ReadResourceAsync(
345341 Throw . IfNullOrWhiteSpace ( uri ) ;
346342
347343 return client . SendRequestAsync < ReadResourceResult > (
348- CreateRequest ( RequestMethods . ResourcesRead , new ( ) { [ "uri" ] = uri } ) ,
344+ CreateRequest ( RequestMethods . ResourcesRead , new Dictionary < string , object ? > ( ) { [ "uri" ] = uri } ) ,
349345 cancellationToken ) ;
350346 }
351347
@@ -369,7 +365,7 @@ public static Task<CompleteResult> GetCompletionAsync(this IMcpClient client, Re
369365 }
370366
371367 return client . SendRequestAsync < CompleteResult > (
372- CreateRequest ( RequestMethods . CompletionComplete , new ( )
368+ CreateRequest ( RequestMethods . CompletionComplete , new Dictionary < string , object ? > ( )
373369 {
374370 [ "ref" ] = reference ,
375371 [ "argument" ] = new Argument { Name = argumentName , Value = argumentValue }
@@ -389,7 +385,7 @@ public static Task SubscribeToResourceAsync(this IMcpClient client, string uri,
389385 Throw . IfNullOrWhiteSpace ( uri ) ;
390386
391387 return client . SendRequestAsync < EmptyResult > (
392- CreateRequest ( RequestMethods . ResourcesSubscribe , new ( ) { [ "uri" ] = uri } ) ,
388+ CreateRequest ( RequestMethods . ResourcesSubscribe , new Dictionary < string , object ? > ( ) { [ "uri" ] = uri } ) ,
393389 cancellationToken ) ;
394390 }
395391
@@ -405,7 +401,7 @@ public static Task UnsubscribeFromResourceAsync(this IMcpClient client, string u
405401 Throw . IfNullOrWhiteSpace ( uri ) ;
406402
407403 return client . SendRequestAsync < EmptyResult > (
408- CreateRequest ( RequestMethods . ResourcesUnsubscribe , new ( ) { [ "uri" ] = uri } ) ,
404+ CreateRequest ( RequestMethods . ResourcesUnsubscribe , new Dictionary < string , object ? > ( ) { [ "uri" ] = uri } ) ,
409405 cancellationToken ) ;
410406 }
411407
@@ -560,11 +556,11 @@ public static Task SetLoggingLevel(this IMcpClient client, LoggingLevel level, C
560556 Throw . IfNull ( client ) ;
561557
562558 return client . SendRequestAsync < EmptyResult > (
563- CreateRequest ( RequestMethods . LoggingSetLevel , new ( ) { [ "level" ] = level } ) ,
559+ CreateRequest ( RequestMethods . LoggingSetLevel , new Dictionary < string , object ? > ( ) { [ "level" ] = level } ) ,
564560 cancellationToken ) ;
565561 }
566562
567- private static JsonRpcRequest CreateRequest ( string method , Dictionary < string , object ? > ? parameters ) =>
563+ private static JsonRpcRequest CreateRequest ( string method , IReadOnlyDictionary < string , object ? > ? parameters ) =>
568564 new ( )
569565 {
570566 Method = method ,
0 commit comments