@@ -26,7 +26,7 @@ def call(message:, server_context: nil)
2626
2727 test "#to_h returns a hash with name, description, and inputSchema" do
2828 tool = Tool . define ( name : "mock_tool" , description : "a mock tool for testing" )
29- assert_equal tool . to_h , { name : "mock_tool" , description : "a mock tool for testing" , inputSchema : { } }
29+ assert_equal tool . to_h , { name : "mock_tool" , description : "a mock tool for testing" , inputSchema : { type : "object" } }
3030 end
3131
3232 test "#to_h includes annotations when present" do
@@ -71,6 +71,15 @@ class DefaultNameTool < Tool
7171 assert_equal tool . tool_name , "default_name_tool"
7272 end
7373
74+ test "input schema defaults to an empty hash" do
75+ class NoInputSchemaTool < Tool ; end
76+
77+ tool = NoInputSchemaTool
78+
79+ expected = { type : "object" }
80+ assert_equal expected , tool . input_schema . to_h
81+ end
82+
7483 test "accepts input schema as an InputSchema object" do
7584 class InputSchemaTool < Tool
7685 input_schema InputSchema . new ( properties : { message : { type : "string" } } , required : [ :message ] )
@@ -106,7 +115,7 @@ class InputSchemaTool < Tool
106115
107116 assert_equal tool . name_value , "mock_tool"
108117 assert_equal tool . description , "a mock tool for testing"
109- assert_equal tool . input_schema , nil
118+ assert_equal tool . input_schema , Tool :: InputSchema . new
110119 end
111120
112121 test ".define allows definition of tools with annotations" do
@@ -123,7 +132,7 @@ class InputSchemaTool < Tool
123132
124133 assert_equal tool . name_value , "mock_tool"
125134 assert_equal tool . description , "a mock tool for testing"
126- assert_equal tool . input_schema , nil
135+ assert_equal tool . input_schema , Tool :: InputSchema . new
127136 assert_equal tool . annotations_value . to_h , { title : "Mock Tool" , readOnlyHint : true }
128137 end
129138
0 commit comments