@@ -17,6 +17,17 @@ class ServerTest < ActiveSupport::TestCase
1717 input_schema : { type : "object" , properties : { message : { type : "string" } } , required : [ "message" ] } ,
1818 ) { raise StandardError , "Tool error" }
1919
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+
2031 @prompt = Prompt . define (
2132 name : "test_prompt" ,
2233 description : "Test prompt" ,
@@ -896,6 +907,27 @@ def call(message:, server_context: nil)
896907 assert_equal "OK" , response [ :result ] [ :content ] [ 0 ] [ :content ]
897908 end
898909
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+
899931 class TestTool < Tool
900932 tool_name "test_tool"
901933 description "a test tool for testing"
0 commit comments