Add tools support to sampling (#976)
This commit is contained in:
parent
ad86b53347
commit
15139cc569
1 changed files with 1623 additions and 425 deletions
30
tests/ModelContextProtocol.Tests/Protocol/ToolChoiceTests.cs
Normal file
30
tests/ModelContextProtocol.Tests/Protocol/ToolChoiceTests.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ModelContextProtocol.Tests.Protocol;
|
||||
|
||||
public class ToolChoiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void DefaultModeIsNull()
|
||||
{
|
||||
Assert.Null(new ToolChoice().Mode);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("none")]
|
||||
[InlineData("required")]
|
||||
[InlineData("auto")]
|
||||
[InlineData("something_custom")]
|
||||
public void SerializesWithMode(string? mode)
|
||||
{
|
||||
ToolChoice toolChoice = new() { Mode = mode };
|
||||
|
||||
var json = JsonSerializer.Serialize(toolChoice, McpJsonUtilities.DefaultOptions);
|
||||
var deserialized = JsonSerializer.Deserialize<ToolChoice>(json, McpJsonUtilities.DefaultOptions);
|
||||
|
||||
Assert.NotNull(deserialized);
|
||||
Assert.Equal(mode, deserialized.Mode);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue