Skip to content

Commit 2b54bc8

Browse files
stephentoubCopilot
authored andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 80fbe01 commit 2b54bc8

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/ModelContextProtocol.Core/Client/McpClient.Methods.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,12 @@ async ValueTask<CallToolResult> SendRequestWithProgressAsync(
592592
}).ConfigureAwait(false);
593593

594594
var metaWithProgress = meta is not null ? new JsonObject(meta) : new JsonObject();
595-
metaWithProgress["progressToken"] = JsonValue.Create(progressToken.Token as string);
595+
metaWithProgress["progressToken"] = progressToken.Token switch
596+
{
597+
string s => JsonValue.Create(s),
598+
long l => JsonValue.Create(l),
599+
_ => throw new InvalidOperationException("ProgressToken must be a string or long")
600+
};
596601

597602
return await SendRequestAsync(
598603
RequestMethods.ToolsCall,

src/ModelContextProtocol.Core/Client/McpClientPrompt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ public async ValueTask<GetPromptResult> GetAsync(
9797
arguments as IReadOnlyDictionary<string, object?> ??
9898
arguments?.ToDictionary();
9999

100-
return await _client.GetPromptAsync(ProtocolPrompt.Name, argDict, new RequestOptions(){JsonSerializerOptions = serializerOptions}, cancellationToken).ConfigureAwait(false);
100+
return await _client.GetPromptAsync(ProtocolPrompt.Name, argDict, new RequestOptions() { JsonSerializerOptions = serializerOptions }, cancellationToken).ConfigureAwait(false);
101101
}
102102
}

tests/ModelContextProtocol.Tests/Client/McpClientMetaTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public McpClientMetaTests(ITestOutputHelper outputHelper)
1313
{
1414
}
1515

16-
protected override void ConfigureServices(ServiceCollection services, IMcpServerBuilder mcpServerBuilder)
16+
protected override void ConfigureServices(ServiceCollection services, IMcpServerBuilder mcpServerBuilder)
1717
{
1818
services.Configure<McpServerOptions>(o =>
1919
{

0 commit comments

Comments
 (0)