File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ def call_tool(request)
233
233
raise RequestHandlerError . new ( "Tool not found #{ tool_name } " , request , error_type : :tool_not_found )
234
234
end
235
235
236
- arguments = request [ :arguments ]
236
+ arguments = request [ :arguments ] || { }
237
237
add_instrumentation_data ( tool_name :)
238
238
239
239
if tool . input_schema &.missing_required_arguments? ( arguments )
Original file line number Diff line number Diff line change @@ -829,6 +829,29 @@ def call(message:, server_context: nil)
829
829
assert_equal custom_version , response [ :result ] [ :protocolVersion ]
830
830
end
831
831
832
+ test "tools/call handles missing arguments field" do
833
+ server = Server . new (
834
+ tools : [ TestTool ] ,
835
+ configuration : Configuration . new ( validate_tool_call_arguments : true ) ,
836
+ )
837
+
838
+ response = server . handle (
839
+ {
840
+ jsonrpc : "2.0" ,
841
+ id : 1 ,
842
+ method : "tools/call" ,
843
+ params : {
844
+ name : "test_tool" ,
845
+ } ,
846
+ } ,
847
+ )
848
+
849
+ assert_equal "2.0" , response [ :jsonrpc ]
850
+ assert_equal 1 , response [ :id ]
851
+ assert_equal ( -32603 , response [ :error ] [ :code ] )
852
+ assert_includes response [ :error ] [ :data ] , "Missing required arguments"
853
+ end
854
+
832
855
test "tools/call validates arguments against input schema when validate_tool_call_arguments is true" do
833
856
server = Server . new (
834
857
tools : [ TestTool ] ,
You can’t perform that action at this time.
0 commit comments