File tree Expand file tree Collapse file tree
src/ModelContextProtocol.Core/Protocol
tests/ModelContextProtocol.Tests/Protocol Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public sealed class Tool : IBaseMetadata
1515{
1616 /// <inheritdoc />
1717 [ JsonPropertyName ( "name" ) ]
18- public string Name { get ; set ; } = string . Empty ;
18+ public required string Name { get ; set ; }
1919
2020 /// <inheritdoc />
2121 [ JsonPropertyName ( "title" ) ]
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ public static void Tool_HasCorrectJsonPropertyNames()
9595 [ Fact ]
9696 public static void ToolInputSchema_HasValidDefaultSchema ( )
9797 {
98- var tool = new Tool ( ) ;
98+ var tool = new Tool { Name = "test" } ;
9999 JsonElement jsonElement = tool . InputSchema ;
100100
101101 Assert . Equal ( JsonValueKind . Object , jsonElement . ValueKind ) ;
@@ -119,7 +119,7 @@ public static void ToolInputSchema_HasValidDefaultSchema()
119119 public static void ToolInputSchema_RejectsInvalidSchemaDocuments ( string invalidSchema )
120120 {
121121 using var document = JsonDocument . Parse ( invalidSchema ) ;
122- var tool = new Tool ( ) ;
122+ var tool = new Tool { Name = "test" } ;
123123
124124 Assert . Throws < ArgumentException > ( ( ) => tool . InputSchema = document . RootElement ) ;
125125 }
@@ -133,6 +133,7 @@ public static void ToolInputSchema_AcceptsValidSchemaDocuments(string validSchem
133133 using var document = JsonDocument . Parse ( validSchema ) ;
134134 Tool tool = new ( )
135135 {
136+ Name = "test" ,
136137 InputSchema = document . RootElement
137138 } ;
138139
You can’t perform that action at this time.
0 commit comments