Streamable HTTP resumability + redelivery + SSE polling via server-side disconnect (#1077)

Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Mackinnon Buck 2026-01-14 22:54:25 -08:00 • committed by GitHub
commit b8311756b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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";