@@ -320,7 +320,7 @@ def call(message, server_context: nil)
320320 assert_equal [ { type : "text" , content : "OK" } ] , response . content
321321 end
322322
323- test "input_schema rejects any $ref in schema" do
323+ test "input_schema accepts $ref in schema" do
324324 schema_with_ref = {
325325 properties : {
326326 foo : { "$ref" => "#/definitions/bar" } ,
@@ -330,12 +330,10 @@ def call(message, server_context: nil)
330330 bar : { type : "string" } ,
331331 } ,
332332 }
333- error = assert_raises ( ArgumentError ) do
334- Class . new ( MCP ::Tool ) do
335- input_schema schema_with_ref
336- end
333+ tool_class = Class . new ( MCP ::Tool ) do
334+ input_schema schema_with_ref
337335 end
338- assert_match ( /Invalid JSON Schema/ , error . message )
336+ assert_equal "#/definitions/bar" , tool_class . input_schema . to_h [ :properties ] [ :foo ] [ :$ref ]
339337 end
340338
341339 test "#to_h includes outputSchema when present" do
@@ -409,7 +407,7 @@ class OutputSchemaObjectTool < Tool
409407 assert_includes error . message , "string did not match the following type: number"
410408 end
411409
412- test "output_schema rejects any $ref in schema" do
410+ test "output_schema accepts $ref in schema" do
413411 schema_with_ref = {
414412 properties : {
415413 foo : { "$ref" => "#/definitions/bar" } ,
@@ -419,12 +417,10 @@ class OutputSchemaObjectTool < Tool
419417 bar : { type : "string" } ,
420418 } ,
421419 }
422- error = assert_raises ( ArgumentError ) do
423- Class . new ( MCP ::Tool ) do
424- output_schema schema_with_ref
425- end
420+ tool_class = Class . new ( MCP ::Tool ) do
421+ output_schema schema_with_ref
426422 end
427- assert_match ( /Invalid JSON Schema/ , error . message )
423+ assert_equal "#/definitions/bar" , tool_class . output_schema . to_h [ :properties ] [ :foo ] [ :$ref ]
428424 end
429425
430426 test ".define allows definition of tools with output_schema" do
0 commit comments