Wrap each request in a service scope (#276)
* Wrap each request in a service scope * Change request/notification delegates to return ValueTask * Address feedback
This commit is contained in:
parent
f1cc2d81de
commit
f4c87f5e2f
1 changed files with 477 additions and 306 deletions
|
|
@ -265,7 +265,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
|
|||
{
|
||||
var notificationParams = JsonSerializer.Deserialize<ResourceUpdatedNotificationParams>(notification.Params, McpJsonUtilities.DefaultOptions);
|
||||
tcs.TrySetResult(true);
|
||||
return Task.CompletedTask;
|
||||
return default;
|
||||
})
|
||||
]
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
|
|||
{
|
||||
var notificationParams = JsonSerializer.Deserialize<ResourceUpdatedNotificationParams>(notification.Params, McpJsonUtilities.DefaultOptions);
|
||||
receivedNotification.TrySetResult(true);
|
||||
return Task.CompletedTask;
|
||||
return default;
|
||||
})
|
||||
]
|
||||
}
|
||||
|
|
@ -370,10 +370,10 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
|
|||
{
|
||||
Sampling = new()
|
||||
{
|
||||
SamplingHandler = (_, _, _) =>
|
||||
SamplingHandler = async (_, _, _) =>
|
||||
{
|
||||
samplingHandlerCalls++;
|
||||
return Task.FromResult(new CreateMessageResult
|
||||
return new CreateMessageResult
|
||||
{
|
||||
Model = "test-model",
|
||||
Role = Role.Assistant,
|
||||
|
|
@ -382,7 +382,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
|
|||
Type = "text",
|
||||
Text = "Test response"
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -569,7 +569,7 @@ public partial class ClientIntegrationTests : LoggedTest, IClassFixture<ClientIn
|
|||
{
|
||||
receivedNotification.TrySetResult(true);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
return default;
|
||||
})
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue