@@ -386,7 +386,7 @@ public async Task Can_Handle_Notify_Cancel()
386386 var token = TestContext . Current . CancellationToken ;
387387 TaskCompletionSource < JsonRpcNotification > clientReceived = new ( ) ;
388388 await using var client = await CreateMcpClientForServer (
389- options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , notification =>
389+ options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , cancellationToken ) =>
390390 {
391391 clientReceived . TrySetResult ( notification ) ;
392392 return clientReceived . Task ;
@@ -422,7 +422,7 @@ public async Task Should_Not_Intercept_Sent_Notifications()
422422 var token = TestContext . Current . CancellationToken ;
423423 TaskCompletionSource < JsonRpcNotification > clientReceived = new ( ) ;
424424 await using var client = await CreateMcpClientForServer (
425- options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , notification =>
425+ options : CreateClientOptions ( [ new ( NotificationMethods . CancelledNotification , ( notification , cancellationToken ) =>
426426 {
427427 var exception = new InvalidOperationException ( "Should not intercept sent notifications" ) ;
428428 clientReceived . TrySetException ( exception ) ;
@@ -452,9 +452,9 @@ public async Task Can_Notify_Cancel()
452452 var token = TestContext . Current . CancellationToken ;
453453 TaskCompletionSource clientReceived = new ( ) ;
454454 await using var client = await CreateMcpClientForServer (
455- options : CreateClientOptions ( new Dictionary < string , Func < JsonRpcNotification , Task > > ( )
455+ options : CreateClientOptions ( new Dictionary < string , Func < JsonRpcNotification , CancellationToken , Task > > ( )
456456 {
457- [ NotificationMethods . CancelledNotification ] = notification =>
457+ [ NotificationMethods . CancelledNotification ] = ( notification , cancellationToken ) =>
458458 {
459459 InvalidOperationException exception = new ( "Should not intercept sent notifications" ) ;
460460 clientReceived . TrySetException ( exception ) ;
@@ -480,7 +480,7 @@ await Assert.ThrowsAsync<TimeoutException>(
480480 }
481481
482482 private static McpClientOptions CreateClientOptions (
483- IEnumerable < KeyValuePair < string , Func < JsonRpcNotification , Task > > > ? notificationHandlers = null )
483+ IEnumerable < KeyValuePair < string , Func < JsonRpcNotification , CancellationToken , Task > > > ? notificationHandlers = null )
484484 => new ( )
485485 {
486486 Capabilities = new ( )
0 commit comments