Skip to content

Commit f4cbc98

Browse files
committed
Fix StreamableHttpServerConformanceTests
1 parent 1722cb5 commit f4cbc98

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/ModelContextProtocol.AspNetCore.Tests/StreamableHttpServerConformanceTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public async Task McpServer_UsedOutOfScope_CanSendNotifications()
540540
SetSessionId(sessionId);
541541

542542
// Call the subscribe method to capture the McpServer instance.
543-
using var response = await HttpClient.PostAsync("", JsonContent(Request("resources/subscribe")), TestContext.Current.CancellationToken);
543+
using var response = await HttpClient.PostAsync("", JsonContent(SubscribeToResource("file:///test")), TestContext.Current.CancellationToken);
544544
var rpcResponse = await AssertSingleSseResponseAsync(response);
545545
AssertType<EmptyResult>(rpcResponse.Result);
546546
Assert.NotNull(capturedServer);
@@ -629,6 +629,11 @@ private string CallToolWithProgressToken(string toolName, string arguments = "{}
629629
{"name":"{{{toolName}}}","arguments":{{{arguments}}},"_meta":{"progressToken":"abc123"}}
630630
""");
631631

632+
private string SubscribeToResource(string uri) =>
633+
Request("resources/subscribe", $$"""
634+
{"uri":"{{uri}}"}
635+
""");
636+
632637
private static InitializeResult AssertServerInfo(JsonRpcResponse rpcResponse)
633638
{
634639
var initializeResult = AssertType<InitializeResult>(rpcResponse.Result);

0 commit comments

Comments
 (0)