@@ -39,7 +39,7 @@ public static class McpClientExtensions
3939 [ Obsolete ( $ "Use { nameof ( McpClient ) } .{ nameof ( McpClient . PingAsync ) } instead. This member will be removed in a subsequent release.") ] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
4040 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
4141 public static Task PingAsync ( this IMcpClient client , CancellationToken cancellationToken = default )
42- => AsClientOrThrow ( client ) . PingAsync ( cancellationToken ) ;
42+ => AsClientOrThrow ( client ) . PingAsync ( null , cancellationToken ) . AsTask ( ) ;
4343
4444 /// <summary>
4545 /// Retrieves a list of available tools from the server.
@@ -86,7 +86,7 @@ public static ValueTask<IList<McpClientTool>> ListToolsAsync(
8686 this IMcpClient client ,
8787 JsonSerializerOptions ? serializerOptions = null ,
8888 CancellationToken cancellationToken = default )
89- => AsClientOrThrow ( client ) . ListToolsAsync ( serializerOptions , cancellationToken ) ;
89+ => AsClientOrThrow ( client ) . ListToolsAsync ( new RequestOptions { JsonSerializerOptions = serializerOptions } , cancellationToken ) ;
9090
9191 /// <summary>
9292 /// Creates an enumerable for asynchronously enumerating all available tools from the server.
@@ -126,7 +126,7 @@ public static IAsyncEnumerable<McpClientTool> EnumerateToolsAsync(
126126 this IMcpClient client ,
127127 JsonSerializerOptions ? serializerOptions = null ,
128128 CancellationToken cancellationToken = default )
129- => AsClientOrThrow ( client ) . EnumerateToolsAsync ( serializerOptions , cancellationToken ) ;
129+ => AsClientOrThrow ( client ) . EnumerateToolsAsync ( new RequestOptions { JsonSerializerOptions = serializerOptions } , cancellationToken ) ;
130130
131131 /// <summary>
132132 /// Retrieves a list of available prompts from the server.
@@ -149,7 +149,7 @@ public static IAsyncEnumerable<McpClientTool> EnumerateToolsAsync(
149149 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
150150 public static ValueTask < IList < McpClientPrompt > > ListPromptsAsync (
151151 this IMcpClient client , CancellationToken cancellationToken = default )
152- => AsClientOrThrow ( client ) . ListPromptsAsync ( cancellationToken ) ;
152+ => AsClientOrThrow ( client ) . ListPromptsAsync ( null , cancellationToken ) ;
153153
154154 /// <summary>
155155 /// Creates an enumerable for asynchronously enumerating all available prompts from the server.
@@ -182,7 +182,7 @@ public static ValueTask<IList<McpClientPrompt>> ListPromptsAsync(
182182 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
183183 public static IAsyncEnumerable < McpClientPrompt > EnumeratePromptsAsync (
184184 this IMcpClient client , CancellationToken cancellationToken = default )
185- => AsClientOrThrow ( client ) . EnumeratePromptsAsync ( cancellationToken ) ;
185+ => AsClientOrThrow ( client ) . EnumeratePromptsAsync ( null , cancellationToken ) ;
186186
187187 /// <summary>
188188 /// Retrieves a specific prompt from the MCP server.
@@ -217,7 +217,7 @@ public static ValueTask<GetPromptResult> GetPromptAsync(
217217 IReadOnlyDictionary < string , object ? > ? arguments = null ,
218218 JsonSerializerOptions ? serializerOptions = null ,
219219 CancellationToken cancellationToken = default )
220- => AsClientOrThrow ( client ) . GetPromptAsync ( name , arguments , serializerOptions , cancellationToken ) ;
220+ => AsClientOrThrow ( client ) . GetPromptAsync ( name , arguments , new RequestOptions { JsonSerializerOptions = serializerOptions } , cancellationToken ) ;
221221
222222 /// <summary>
223223 /// Retrieves a list of available resource templates from the server.
@@ -240,7 +240,7 @@ public static ValueTask<GetPromptResult> GetPromptAsync(
240240 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
241241 public static ValueTask < IList < McpClientResourceTemplate > > ListResourceTemplatesAsync (
242242 this IMcpClient client , CancellationToken cancellationToken = default )
243- => AsClientOrThrow ( client ) . ListResourceTemplatesAsync ( cancellationToken ) ;
243+ => AsClientOrThrow ( client ) . ListResourceTemplatesAsync ( null , cancellationToken ) ;
244244
245245 /// <summary>
246246 /// Creates an enumerable for asynchronously enumerating all available resource templates from the server.
@@ -273,7 +273,7 @@ public static ValueTask<IList<McpClientResourceTemplate>> ListResourceTemplatesA
273273 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
274274 public static IAsyncEnumerable < McpClientResourceTemplate > EnumerateResourceTemplatesAsync (
275275 this IMcpClient client , CancellationToken cancellationToken = default )
276- => AsClientOrThrow ( client ) . EnumerateResourceTemplatesAsync ( cancellationToken ) ;
276+ => AsClientOrThrow ( client ) . EnumerateResourceTemplatesAsync ( null , cancellationToken ) ;
277277
278278 /// <summary>
279279 /// Retrieves a list of available resources from the server.
@@ -308,7 +308,7 @@ public static IAsyncEnumerable<McpClientResourceTemplate> EnumerateResourceTempl
308308 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
309309 public static ValueTask < IList < McpClientResource > > ListResourcesAsync (
310310 this IMcpClient client , CancellationToken cancellationToken = default )
311- => AsClientOrThrow ( client ) . ListResourcesAsync ( cancellationToken ) ;
311+ => AsClientOrThrow ( client ) . ListResourcesAsync ( null , cancellationToken ) ;
312312
313313 /// <summary>
314314 /// Creates an enumerable for asynchronously enumerating all available resources from the server.
@@ -341,7 +341,7 @@ public static ValueTask<IList<McpClientResource>> ListResourcesAsync(
341341 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
342342 public static IAsyncEnumerable < McpClientResource > EnumerateResourcesAsync (
343343 this IMcpClient client , CancellationToken cancellationToken = default )
344- => AsClientOrThrow ( client ) . EnumerateResourcesAsync ( cancellationToken ) ;
344+ => AsClientOrThrow ( client ) . EnumerateResourcesAsync ( null , cancellationToken ) ;
345345
346346 /// <summary>
347347 /// Reads a resource from the server.
@@ -356,7 +356,7 @@ public static IAsyncEnumerable<McpClientResource> EnumerateResourcesAsync(
356356 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
357357 public static ValueTask < ReadResourceResult > ReadResourceAsync (
358358 this IMcpClient client , string uri , CancellationToken cancellationToken = default )
359- => AsClientOrThrow ( client ) . ReadResourceAsync ( uri , cancellationToken ) ;
359+ => AsClientOrThrow ( client ) . ReadResourceAsync ( uri , null , cancellationToken ) ;
360360
361361 /// <summary>
362362 /// Reads a resource from the server.
@@ -370,7 +370,7 @@ public static ValueTask<ReadResourceResult> ReadResourceAsync(
370370 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
371371 public static ValueTask < ReadResourceResult > ReadResourceAsync (
372372 this IMcpClient client , Uri uri , CancellationToken cancellationToken = default )
373- => AsClientOrThrow ( client ) . ReadResourceAsync ( uri , cancellationToken ) ;
373+ => AsClientOrThrow ( client ) . ReadResourceAsync ( uri , null , cancellationToken ) ;
374374
375375 /// <summary>
376376 /// Reads a resource from the server.
@@ -386,7 +386,7 @@ public static ValueTask<ReadResourceResult> ReadResourceAsync(
386386 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
387387 public static ValueTask < ReadResourceResult > ReadResourceAsync (
388388 this IMcpClient client , string uriTemplate , IReadOnlyDictionary < string , object ? > arguments , CancellationToken cancellationToken = default )
389- => AsClientOrThrow ( client ) . ReadResourceAsync ( uriTemplate , arguments , cancellationToken ) ;
389+ => AsClientOrThrow ( client ) . ReadResourceAsync ( uriTemplate , arguments , null , cancellationToken ) ;
390390
391391 /// <summary>
392392 /// Requests completion suggestions for a prompt argument or resource reference.
@@ -450,7 +450,7 @@ public static ValueTask<CompleteResult> CompleteAsync(this IMcpClient client, Re
450450 [ Obsolete ( $ "Use { nameof ( McpClient ) } .{ nameof ( McpClient . SubscribeToResourceAsync ) } instead. This member will be removed in a subsequent release.") ] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
451451 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
452452 public static Task SubscribeToResourceAsync ( this IMcpClient client , string uri , CancellationToken cancellationToken = default )
453- => AsClientOrThrow ( client ) . SubscribeToResourceAsync ( uri , cancellationToken ) ;
453+ => AsClientOrThrow ( client ) . SubscribeToResourceAsync ( uri , null , cancellationToken ) ;
454454
455455 /// <summary>
456456 /// Subscribes to a resource on the server to receive notifications when it changes.
@@ -479,7 +479,7 @@ public static Task SubscribeToResourceAsync(this IMcpClient client, string uri,
479479 [ Obsolete ( $ "Use { nameof ( McpClient ) } .{ nameof ( McpClient . SubscribeToResourceAsync ) } instead. This member will be removed in a subsequent release.") ] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
480480 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
481481 public static Task SubscribeToResourceAsync ( this IMcpClient client , Uri uri , CancellationToken cancellationToken = default )
482- => AsClientOrThrow ( client ) . SubscribeToResourceAsync ( uri , cancellationToken ) ;
482+ => AsClientOrThrow ( client ) . SubscribeToResourceAsync ( uri , null , cancellationToken ) ;
483483
484484 /// <summary>
485485 /// Unsubscribes from a resource on the server to stop receiving notifications about its changes.
@@ -508,7 +508,7 @@ public static Task SubscribeToResourceAsync(this IMcpClient client, Uri uri, Can
508508 [ Obsolete ( $ "Use { nameof ( McpClient ) } .{ nameof ( McpClient . UnsubscribeFromResourceAsync ) } instead. This member will be removed in a subsequent release.") ] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
509509 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
510510 public static Task UnsubscribeFromResourceAsync ( this IMcpClient client , string uri , CancellationToken cancellationToken = default )
511- => AsClientOrThrow ( client ) . UnsubscribeFromResourceAsync ( uri , cancellationToken ) ;
511+ => AsClientOrThrow ( client ) . UnsubscribeFromResourceAsync ( uri , null , cancellationToken ) ;
512512
513513 /// <summary>
514514 /// Unsubscribes from a resource on the server to stop receiving notifications about its changes.
@@ -536,7 +536,7 @@ public static Task UnsubscribeFromResourceAsync(this IMcpClient client, string u
536536 [ Obsolete ( $ "Use { nameof ( McpClient ) } .{ nameof ( McpClient . UnsubscribeFromResourceAsync ) } instead. This member will be removed in a subsequent release.") ] // See: https://github.com/modelcontextprotocol/csharp-sdk/issues/774
537537 [ EditorBrowsable ( EditorBrowsableState . Never ) ]
538538 public static Task UnsubscribeFromResourceAsync ( this IMcpClient client , Uri uri , CancellationToken cancellationToken = default )
539- => AsClientOrThrow ( client ) . UnsubscribeFromResourceAsync ( uri , cancellationToken ) ;
539+ => AsClientOrThrow ( client ) . UnsubscribeFromResourceAsync ( uri , null , cancellationToken ) ;
540540
541541 /// <summary>
542542 /// Invokes a tool on the server.
@@ -582,7 +582,7 @@ public static ValueTask<CallToolResult> CallToolAsync(
582582 IProgress < ProgressNotificationValue > ? progress = null ,
583583 JsonSerializerOptions ? serializerOptions = null ,
584584 CancellationToken cancellationToken = default )
585- => AsClientOrThrow ( client ) . CallToolAsync ( toolName , arguments , progress , serializerOptions , cancellationToken ) ;
585+ => AsClientOrThrow ( client ) . CallToolAsync ( toolName , arguments , progress , new RequestOptions { JsonSerializerOptions = serializerOptions } , cancellationToken ) ;
586586
587587 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
588588#pragma warning disable CS0618 // Type or member is obsolete
0 commit comments