@@ -17,6 +17,17 @@ class ServerTest < ActiveSupport::TestCase
17
17
input_schema : { type : "object" , properties : { message : { type : "string" } } , required : [ "message" ] } ,
18
18
) { raise StandardError , "Tool error" }
19
19
20
+ @tool_with_no_args = Tool . define (
21
+ name : "tool_with_no_args" ,
22
+ description : "This tool performs specific functionality..." ,
23
+ annotations : {
24
+ title : "Tool with no args" ,
25
+ read_only_hint : true ,
26
+ } ,
27
+ ) do
28
+ Tool ::Response . new ( [ { type : "text" , content : "OK" } ] )
29
+ end
30
+
20
31
@prompt = Prompt . define (
21
32
name : "test_prompt" ,
22
33
description : "Test prompt" ,
@@ -896,6 +907,27 @@ def call(message:, server_context: nil)
896
907
assert_equal "OK" , response [ :result ] [ :content ] [ 0 ] [ :content ]
897
908
end
898
909
910
+ test "tools/call with no args" do
911
+ server = Server . new ( tools : [ @tool_with_no_args ] )
912
+
913
+ response = server . handle (
914
+ {
915
+ jsonrpc : "2.0" ,
916
+ id : 1 ,
917
+ method : "tools/call" ,
918
+ params : {
919
+ name : "tool_with_no_args" ,
920
+ } ,
921
+ } ,
922
+ )
923
+
924
+ assert_equal "2.0" , response [ :jsonrpc ]
925
+ assert_equal 1 , response [ :id ]
926
+ assert response [ :result ] , "Expected result key in response"
927
+ assert_equal "text" , response [ :result ] [ :content ] [ 0 ] [ :type ]
928
+ assert_equal "OK" , response [ :result ] [ :content ] [ 0 ] [ :content ]
929
+ end
930
+
899
931
class TestTool < Tool
900
932
tool_name "test_tool"
901
933
description "a test tool for testing"
0 commit comments