@@ -126,28 +126,29 @@ struct ToolTests {
126
126
func testToolWithEmptyAnnotations( ) throws {
127
127
var tool = Tool (
128
128
name: " test_tool " ,
129
- description: " Test tool description "
129
+ description: " Test tool description " ,
130
+ inputSchema: [ : ] ,
130
131
)
131
132
132
133
do {
133
134
#expect( tool. annotations. isEmpty)
134
-
135
+
135
136
let encoder = JSONEncoder ( )
136
137
let data = try encoder. encode ( tool)
137
-
138
+
138
139
// Verify that empty annotations are not included in the JSON
139
140
let jsonString = String ( data: data, encoding: . utf8) !
140
141
#expect( !jsonString. contains ( " \" annotations \" " ) )
141
142
}
142
-
143
+
143
144
do {
144
145
tool. annotations. title = " Test "
145
146
146
147
#expect( !tool. annotations. isEmpty)
147
-
148
+
148
149
let encoder = JSONEncoder ( )
149
150
let data = try encoder. encode ( tool)
150
-
151
+
151
152
// Verify that empty annotations are not included in the JSON
152
153
let jsonString = String ( data: data, encoding: . utf8) !
153
154
#expect( jsonString. contains ( " \" annotations \" " ) )
@@ -159,7 +160,7 @@ struct ToolTests {
159
160
let tool = Tool (
160
161
name: " test_tool " ,
161
162
description: " Test tool description " ,
162
- inputSchema: nil ,
163
+ inputSchema: [ : ] ,
163
164
annotations: nil
164
165
)
165
166
@@ -318,8 +319,8 @@ struct ToolTests {
318
319
@Test ( " ListTools result validation " )
319
320
func testListToolsResult( ) throws {
320
321
let tools = [
321
- Tool ( name: " tool1 " , description: " First tool " , inputSchema: nil ) ,
322
- Tool ( name: " tool2 " , description: " Second tool " , inputSchema: nil ) ,
322
+ Tool ( name: " tool1 " , description: " First tool " , inputSchema: [ : ] ) ,
323
+ Tool ( name: " tool2 " , description: " Second tool " , inputSchema: [ : ] ) ,
323
324
]
324
325
325
326
let result = ListTools . Result ( tools: tools, nextCursor: " next_page " )
@@ -393,7 +394,11 @@ struct ToolTests {
393
394
#expect( request. id == 1 )
394
395
#expect( request. params. cursor == nil )
395
396
396
- let testTool = Tool ( name: " test_tool " , description: " Test tool for verification " )
397
+ let testTool = Tool (
398
+ name: " test_tool " ,
399
+ description: " Test tool for verification " ,
400
+ inputSchema: [ : ]
401
+ )
397
402
return ListTools . response ( id: request. id, result: ListTools . Result ( tools: [ testTool] ) )
398
403
}
399
404
0 commit comments