@@ -527,7 +527,7 @@ class Example < Tool
527527 assert_match ( /Internal error calling tool tool_with_faulty_schema: Unexpected schema error/ , response [ :result ] [ :content ] [ 0 ] [ :text ] )
528528 end
529529
530- test "#handle tools/call returns error response with isError true for unknown tool" do
530+ test "#handle tools/call returns JSON-RPC error for unknown tool" do
531531 request = {
532532 jsonrpc : "2.0" ,
533533 method : "tools/call" ,
@@ -539,14 +539,14 @@ class Example < Tool
539539 }
540540
541541 response = @server . handle ( request )
542- assert_nil response [ :error ] , "Expected no JSON-RPC error"
543- assert response [ :result ] [ :isError ]
544- assert_equal "text " , response [ :result ] [ :content ] [ 0 ] [ :type ]
545- assert_equal "Tool not found: unknown_tool" , response [ :result ] [ :content ] [ 0 ] [ :text ]
546- assert_instrumentation_data ( { method : "tools/call" , tool_name : "unknown_tool" , error : :tool_not_found } )
542+ assert_nil response [ :result ]
543+ assert_equal ( - 32602 , response [ :error ] [ :code ] )
544+ assert_equal "Invalid params " , response [ :error ] [ :message ]
545+ assert_includes response [ :error ] [ :data ] , "Tool not found: unknown_tool"
546+ assert_instrumentation_data ( { method : "tools/call" , tool_name : "unknown_tool" , error : :invalid_params } )
547547 end
548548
549- test "#handle_json returns error response with isError true for unknown tool" do
549+ test "#handle_json returns JSON-RPC error for unknown tool" do
550550 request = JSON . generate ( {
551551 jsonrpc : "2.0" ,
552552 method : "tools/call" ,
@@ -558,10 +558,10 @@ class Example < Tool
558558 } )
559559
560560 response = JSON . parse ( @server . handle_json ( request ) , symbolize_names : true )
561- assert_nil response [ :error ] , "Expected no JSON-RPC error"
562- assert response [ :result ] [ :isError ]
563- assert_equal "text " , response [ :result ] [ :content ] [ 0 ] [ :type ]
564- assert_equal "Tool not found: unknown_tool" , response [ :result ] [ :content ] [ 0 ] [ :text ]
561+ assert_nil response [ :result ]
562+ assert_equal ( - 32602 , response [ :error ] [ :code ] )
563+ assert_equal "Invalid params " , response [ :error ] [ :message ]
564+ assert_includes response [ :error ] [ :data ] , "Tool not found: unknown_tool"
565565 end
566566
567567 test "#tools_call_handler sets the tools/call handler" do
0 commit comments