Add McpServerPrompt / McpClientPrompt and friends (#126)

This commit is contained in:
Stephen Toub 2025-03-31 09:54:40 -04:00 • committed by GitHub
commit 5d3fb65b11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using ModelContextProtocol.Client;
using ModelContextProtocol.Configuration;
using ModelContextProtocol.Protocol.Messages;
using ModelContextProtocol.Protocol.Transport;
using ModelContextProtocol.Protocol.Types;
@ -356,16 +355,16 @@ public class McpServerBuilderExtensionsToolsTests : LoggedTest, IAsyncDisposable
Assert.Contains("'NotRegisteredTool'", e.Message);
}
[Fact(Skip = "https://github.com/dotnet/extensions/issues/6124")]
public async Task Throws_Exception_Missing_Parameter()
[Fact]
public async Task Returns_IsError_Missing_Parameter()
{
IMcpClient client = await CreateMcpClientForServer();
var e = await Assert.ThrowsAsync<McpClientException>(async () => await client.CallToolAsync(
var result = await client.CallToolAsync(
"Echo",
cancellationToken: TestContext.Current.CancellationToken));
cancellationToken: TestContext.Current.CancellationToken);
Assert.Equal("Missing required argument 'message'.", e.Message);
Assert.True(result.IsError);
}
[Fact]