@@ -14,7 +14,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
1414 name : "test_server" ,
1515 tools : [ ] ,
1616 prompts : [ ] ,
17- resources : [ ]
17+ resources : [ ] ,
1818 )
1919 @transport = HTTP . new ( @server )
2020 @server . transport = @transport
@@ -26,7 +26,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
2626 "POST" ,
2727 "/" ,
2828 { "CONTENT_TYPE" => "application/json" } ,
29- { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json
29+ { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json ,
3030 )
3131 init_response = @transport . handle_request ( init_request )
3232 session_id = init_response [ 1 ] [ "Mcp-Session-Id" ]
@@ -36,7 +36,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
3636 get_request = create_rack_request (
3737 "GET" ,
3838 "/" ,
39- { "HTTP_MCP_SESSION_ID" => session_id }
39+ { "HTTP_MCP_SESSION_ID" => session_id } ,
4040 )
4141 response = @transport . handle_request ( get_request )
4242 response [ 2 ] . call ( io ) if response [ 2 ] . is_a? ( Proc )
@@ -68,7 +68,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
6868 "POST" ,
6969 "/" ,
7070 { "CONTENT_TYPE" => "application/json" } ,
71- { jsonrpc : "2.0" , method : "initialize" , id : "123" } . to_json
71+ { jsonrpc : "2.0" , method : "initialize" , id : "123" } . to_json ,
7272 )
7373 init_response1 = @transport . handle_request ( init_request1 )
7474 session_id1 = init_response1 [ 1 ] [ "Mcp-Session-Id" ]
@@ -77,7 +77,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
7777 "POST" ,
7878 "/" ,
7979 { "CONTENT_TYPE" => "application/json" } ,
80- { jsonrpc : "2.0" , method : "initialize" , id : "456" } . to_json
80+ { jsonrpc : "2.0" , method : "initialize" , id : "456" } . to_json ,
8181 )
8282 init_response2 = @transport . handle_request ( init_request2 )
8383 session_id2 = init_response2 [ 1 ] [ "Mcp-Session-Id" ]
@@ -87,7 +87,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
8787 get_request1 = create_rack_request (
8888 "GET" ,
8989 "/" ,
90- { "HTTP_MCP_SESSION_ID" => session_id1 }
90+ { "HTTP_MCP_SESSION_ID" => session_id1 } ,
9191 )
9292 response1 = @transport . handle_request ( get_request1 )
9393 response1 [ 2 ] . call ( io1 ) if response1 [ 2 ] . is_a? ( Proc )
@@ -96,7 +96,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
9696 get_request2 = create_rack_request (
9797 "GET" ,
9898 "/" ,
99- { "HTTP_MCP_SESSION_ID" => session_id2 }
99+ { "HTTP_MCP_SESSION_ID" => session_id2 } ,
100100 )
101101 response2 = @transport . handle_request ( get_request2 )
102102 response2 [ 2 ] . call ( io2 ) if response2 [ 2 ] . is_a? ( Proc )
@@ -123,7 +123,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
123123 "POST" ,
124124 "/" ,
125125 { "CONTENT_TYPE" => "application/json" } ,
126- { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json
126+ { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json ,
127127 )
128128 init_response = @transport . handle_request ( init_request )
129129 session_id = init_response [ 1 ] [ "Mcp-Session-Id" ]
@@ -133,7 +133,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
133133 get_request = create_rack_request (
134134 "GET" ,
135135 "/" ,
136- { "HTTP_MCP_SESSION_ID" => session_id }
136+ { "HTTP_MCP_SESSION_ID" => session_id } ,
137137 )
138138 response = @transport . handle_request ( get_request )
139139 response [ 2 ] . call ( io ) if response [ 2 ] . is_a? ( Proc )
@@ -158,7 +158,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
158158 "POST" ,
159159 "/" ,
160160 { "CONTENT_TYPE" => "application/json" } ,
161- { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json
161+ { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json ,
162162 )
163163 init_response = @transport . handle_request ( init_request )
164164 session_id = init_response [ 1 ] [ "Mcp-Session-Id" ]
@@ -168,7 +168,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
168168 get_request = create_rack_request (
169169 "GET" ,
170170 "/" ,
171- { "HTTP_MCP_SESSION_ID" => session_id }
171+ { "HTTP_MCP_SESSION_ID" => session_id } ,
172172 )
173173 response = @transport . handle_request ( get_request )
174174 response [ 2 ] . call ( io ) if response [ 2 ] . is_a? ( Proc )
@@ -179,8 +179,8 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
179179 # Define a new tool (simulating dynamic tool addition)
180180 @server . define_tool (
181181 name : "dynamic_tool" ,
182- description : "A dynamically added tool"
183- ) do |**args |
182+ description : "A dynamically added tool" ,
183+ ) do |**_args |
184184 { result : "success" }
185185 end
186186
@@ -202,7 +202,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
202202 "POST" ,
203203 "/" ,
204204 { "CONTENT_TYPE" => "application/json" } ,
205- { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json
205+ { jsonrpc : "2.0" , method : "initialize" , id : "init" } . to_json ,
206206 )
207207 init_response = @transport . handle_request ( init_request )
208208 session_id = init_response [ 1 ] [ "Mcp-Session-Id" ]
@@ -212,7 +212,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
212212 get_request = create_rack_request (
213213 "GET" ,
214214 "/" ,
215- { "HTTP_MCP_SESSION_ID" => session_id }
215+ { "HTTP_MCP_SESSION_ID" => session_id } ,
216216 )
217217 response = @transport . handle_request ( get_request )
218218 response [ 2 ] . call ( io ) if response [ 2 ] . is_a? ( Proc )
@@ -226,7 +226,7 @@ class HTTPNotificationIntegrationTest < ActiveSupport::TestCase
226226 # Check SSE format
227227 io . rewind
228228 output = io . read
229-
229+
230230 # SSE format should be "data: <message>\n\n"
231231 assert_match ( /data: #{ Regexp . escape ( Methods ::NOTIFICATIONS_TOOLS_LIST_CHANGED ) } \n / , output )
232232 end
@@ -237,11 +237,11 @@ def create_rack_request(method, path, headers, body = nil)
237237 env = {
238238 "REQUEST_METHOD" => method ,
239239 "PATH_INFO" => path ,
240- "rack.input" => StringIO . new ( body . to_s )
240+ "rack.input" => StringIO . new ( body . to_s ) ,
241241 } . merge ( headers )
242242
243243 Rack ::Request . new ( env )
244244 end
245245 end
246246 end
247- end
247+ end
0 commit comments