Make Tool.Name required to match other protocol types (#1351)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
This commit is contained in:
parent
fa56de9880
commit
9b5d0fe80a
2 changed files with 4 additions and 3 deletions
|
|
@ -15,7 +15,7 @@ public sealed class Tool : IBaseMetadata
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[JsonPropertyName("name")]
|
[JsonPropertyName("name")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public required string Name { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[JsonPropertyName("title")]
|
[JsonPropertyName("title")]
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public static class ToolTests
|
||||||
[Fact]
|
[Fact]
|
||||||
public static void ToolInputSchema_HasValidDefaultSchema()
|
public static void ToolInputSchema_HasValidDefaultSchema()
|
||||||
{
|
{
|
||||||
var tool = new Tool();
|
var tool = new Tool { Name = "test" };
|
||||||
JsonElement jsonElement = tool.InputSchema;
|
JsonElement jsonElement = tool.InputSchema;
|
||||||
|
|
||||||
Assert.Equal(JsonValueKind.Object, jsonElement.ValueKind);
|
Assert.Equal(JsonValueKind.Object, jsonElement.ValueKind);
|
||||||
|
|
@ -119,7 +119,7 @@ public static class ToolTests
|
||||||
public static void ToolInputSchema_RejectsInvalidSchemaDocuments(string invalidSchema)
|
public static void ToolInputSchema_RejectsInvalidSchemaDocuments(string invalidSchema)
|
||||||
{
|
{
|
||||||
using var document = JsonDocument.Parse(invalidSchema);
|
using var document = JsonDocument.Parse(invalidSchema);
|
||||||
var tool = new Tool();
|
var tool = new Tool { Name = "test" };
|
||||||
|
|
||||||
Assert.Throws<ArgumentException>(() => tool.InputSchema = document.RootElement);
|
Assert.Throws<ArgumentException>(() => tool.InputSchema = document.RootElement);
|
||||||
}
|
}
|
||||||
|
|
@ -133,6 +133,7 @@ public static class ToolTests
|
||||||
using var document = JsonDocument.Parse(validSchema);
|
using var document = JsonDocument.Parse(validSchema);
|
||||||
Tool tool = new()
|
Tool tool = new()
|
||||||
{
|
{
|
||||||
|
Name = "test",
|
||||||
InputSchema = document.RootElement
|
InputSchema = document.RootElement
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue