File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -563,6 +563,7 @@ class WeatherTool < MCP::Tool
563563 )
564564end
565565```
566+
566567Please note: in this case, you must provide ` type: "array" ` . The default type
567568for output schemas is ` object ` .
568569
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- require "json"
43require "json-schema"
54
65module MCP
@@ -33,19 +32,19 @@ def validate_result(result)
3332
3433 private
3534
36- def deep_transform_keys ( hash , &block )
37- case hash
35+ def deep_transform_keys ( schema , &block )
36+ case schema
3837 when Hash
39- hash . each_with_object ( { } ) do |( key , value ) , result |
40- if key . casecmp? ( "$ref" ) || key == :$ref
38+ schema . each_with_object ( { } ) do |( key , value ) , result |
39+ if key . casecmp? ( "$ref" )
4140 raise ArgumentError , "Invalid JSON Schema: $ref is not allowed in tool output schemas"
4241 end
4342 result [ yield ( key ) ] = deep_transform_keys ( value , &block )
4443 end
4544 when Array
46- hash . map { |e | deep_transform_keys ( e , &block ) }
45+ schema . map { |e | deep_transform_keys ( e , &block ) }
4746 else
48- hash
47+ schema
4948 end
5049 end
5150
You can’t perform that action at this time.
0 commit comments