66require "webmock/minitest"
77require "mcp/client/http"
88require "mcp/client/tool"
9- require "mcp/client/tools"
109require "mcp/client"
1110
1211module MCP
13- module Client
14- class HttpTest < Minitest ::Test
15- def test_initialization_with_default_version
16- assert_equal ( "0.1.0" , client . version )
17- assert_equal ( url , client . url )
18- end
19-
20- def test_initialization_with_custom_version
21- custom_version = "1.2.3"
22- client = Http . new ( url : url , version : custom_version )
23- assert_equal ( custom_version , client . version )
24- end
12+ class Client
13+ class HTTPTest < Minitest ::Test
14+ # def test_initialization_with_default_version
15+ # assert_equal("0.1.0", client.version)
16+ # assert_equal(url, client.url)
17+ # end
18+
19+ # def test_initialization_with_custom_version
20+ # custom_version = "1.2.3"
21+ # client = HTTP .new(url: url, version: custom_version)
22+ # assert_equal(custom_version, client.version)
23+ # end
2524
2625 def test_raises_load_error_when_faraday_not_available
27- client = Http . new ( url : url )
26+ client = HTTP . new ( url : url )
2827
2928 # simulate Faraday not being available
30- Http . any_instance . stubs ( :require ) . with ( "faraday" ) . raises ( LoadError , "cannot load such file -- faraday" )
29+ HTTP . any_instance . stubs ( :require ) . with ( "faraday" ) . raises ( LoadError , "cannot load such file -- faraday" )
3130
3231 error = assert_raises ( LoadError ) do
3332 # I picked #tools arbitrarily.
@@ -41,7 +40,7 @@ def test_raises_load_error_when_faraday_not_available
4140
4241 def test_headers_are_added_to_the_request
4342 headers = { "Authorization" => "Bearer token" }
44- client = Http . new ( url : url , headers : headers )
43+ client = HTTP . new ( url : url , headers : headers )
4544 client . stubs ( :request_id ) . returns ( mock_request_id )
4645
4746 stub_request ( :post , url )
@@ -108,16 +107,16 @@ def test_tools_returns_tools_instance
108107 )
109108
110109 tools = client . tools
111- assert_instance_of ( Tools , tools )
110+ assert_instance_of ( Array , tools )
112111 assert_equal ( 1 , tools . count )
113112 assert_equal ( "test_tool" , tools . first . name )
114113 end
115114
116115 def test_call_tool_returns_tool_response
117116 tool = Tool . new (
118- " name" => "test_tool" ,
119- " description" => "A test tool" ,
120- "inputSchema" => {
117+ name : "test_tool" ,
118+ description : "A test tool" ,
119+ input_schema : {
121120 "type" => "object" ,
122121 "properties" => { } ,
123122 } ,
@@ -172,9 +171,9 @@ def test_call_tool_returns_tool_response
172171
173172 def test_call_tool_handles_empty_response
174173 tool = Tool . new (
175- " name" => "test_tool" ,
176- " description" => "A test tool" ,
177- "inputSchema" => {
174+ name : "test_tool" ,
175+ description : "A test tool" ,
176+ input_schema : {
178177 "type" => "object" ,
179178 "properties" => { } ,
180179 } ,
@@ -220,9 +219,9 @@ def test_call_tool_handles_empty_response
220219
221220 def test_raises_bad_request_error
222221 tool = Tool . new (
223- " name" => "test_tool" ,
224- " description" => "A test tool" ,
225- "inputSchema" => {
222+ name : "test_tool" ,
223+ description : "A test tool" ,
224+ input_schema : {
226225 "type" => "object" ,
227226 "properties" => { } ,
228227 } ,
@@ -263,9 +262,9 @@ def test_raises_bad_request_error
263262
264263 def test_raises_unauthorized_error
265264 tool = Tool . new (
266- " name" => "test_tool" ,
267- " description" => "A test tool" ,
268- "inputSchema" => {
265+ name : "test_tool" ,
266+ description : "A test tool" ,
267+ input_schema : {
269268 "type" => "object" ,
270269 "properties" => { } ,
271270 } ,
@@ -306,9 +305,9 @@ def test_raises_unauthorized_error
306305
307306 def test_raises_forbidden_error
308307 tool = Tool . new (
309- " name" => "test_tool" ,
310- " description" => "A test tool" ,
311- "inputSchema" => {
308+ name : "test_tool" ,
309+ description : "A test tool" ,
310+ input_schema : {
312311 "type" => "object" ,
313312 "properties" => { } ,
314313 } ,
@@ -349,9 +348,9 @@ def test_raises_forbidden_error
349348
350349 def test_raises_not_found_error
351350 tool = Tool . new (
352- " name" => "test_tool" ,
353- " description" => "A test tool" ,
354- "inputSchema" => {
351+ name : "test_tool" ,
352+ description : "A test tool" ,
353+ input_schema : {
355354 "type" => "object" ,
356355 "properties" => { } ,
357356 } ,
@@ -392,9 +391,9 @@ def test_raises_not_found_error
392391
393392 def test_raises_unprocessable_entity_error
394393 tool = Tool . new (
395- " name" => "test_tool" ,
396- " description" => "A test tool" ,
397- "inputSchema" => {
394+ name : "test_tool" ,
395+ description : "A test tool" ,
396+ input_schema : {
398397 "type" => "object" ,
399398 "properties" => { } ,
400399 } ,
@@ -435,9 +434,9 @@ def test_raises_unprocessable_entity_error
435434
436435 def test_raises_internal_error
437436 tool = Tool . new (
438- " name" => "test_tool" ,
439- " description" => "A test tool" ,
440- "inputSchema" => {
437+ name : "test_tool" ,
438+ description : "A test tool" ,
439+ input_schema : {
441440 "type" => "object" ,
442441 "properties" => { } ,
443442 } ,
@@ -492,7 +491,7 @@ def url
492491
493492 def client
494493 @client ||= begin
495- client = Http . new ( url : url )
494+ client = HTTP . new ( url : url )
496495 client . stubs ( :request_id ) . returns ( mock_request_id )
497496 client
498497 end
0 commit comments