Streamable HTTP resumability + redelivery + SSE polling via server-side disconnect (#1077)
Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
parent
4cb2fd4655
commit
b8311756b4
1 changed files with 2675 additions and 246 deletions
|
|
@ -804,10 +804,10 @@ public partial class McpServerToolTests
|
|||
public void ReturnDescription_StructuredOutputEnabled_WithExplicitDescription_NoSynthesis()
|
||||
{
|
||||
// When UseStructuredContent is true and Description is set, return description goes to output schema
|
||||
McpServerTool tool = McpServerTool.Create(ToolWithReturnDescription, new()
|
||||
{
|
||||
Description = "Custom description",
|
||||
UseStructuredContent = true
|
||||
McpServerTool tool = McpServerTool.Create(ToolWithReturnDescription, new()
|
||||
{
|
||||
Description = "Custom description",
|
||||
UseStructuredContent = true
|
||||
});
|
||||
|
||||
// Description should not have the return description appended
|
||||
|
|
@ -815,6 +815,23 @@ public partial class McpServerToolTests
|
|||
Assert.NotNull(tool.ProtocolTool.OutputSchema);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnablePollingAsync_ThrowsInvalidOperationException_WhenTransportIsNotStreamableHttpPost()
|
||||
{
|
||||
// Arrange
|
||||
Mock<McpServer> mockServer = new();
|
||||
var jsonRpcRequest = CreateTestJsonRpcRequest();
|
||||
|
||||
// The JsonRpcRequest has no Context, so RelatedTransport will be null
|
||||
var requestContext = new RequestContext<CallToolRequestParams>(mockServer.Object, jsonRpcRequest);
|
||||
|
||||
// Act & Assert
|
||||
var exception = await Assert.ThrowsAsync<InvalidOperationException>(
|
||||
() => requestContext.EnablePollingAsync(TimeSpan.FromSeconds(1), TestContext.Current.CancellationToken).AsTask());
|
||||
|
||||
Assert.Contains("Streamable HTTP", exception.Message);
|
||||
}
|
||||
|
||||
[Description("Tool that returns data.")]
|
||||
[return: Description("The computed result")]
|
||||
private static string ToolWithReturnDescription() => "result";
|
||||
|
|
|
|||
Loading…
Reference in a new issue