@@ -71,7 +71,7 @@ public function testHandleSuccessfulToolCall(): void
7171 $ this ->referenceHandler
7272 ->expects ($ this ->once ())
7373 ->method ('handle ' )
74- ->with ($ toolReference , ['name ' => 'John ' , '_session ' => $ this ->session ])
74+ ->with ($ toolReference , ['name ' => 'John ' , '_session ' => $ this ->session , ' _request ' => $ request ])
7575 ->willReturn ('Hello, John! ' );
7676
7777 $ toolReference
@@ -104,7 +104,7 @@ public function testHandleToolCallWithEmptyArguments(): void
104104 $ this ->referenceHandler
105105 ->expects ($ this ->once ())
106106 ->method ('handle ' )
107- ->with ($ toolReference , ['_session ' => $ this ->session ])
107+ ->with ($ toolReference , ['_session ' => $ this ->session , ' _request ' => $ request ])
108108 ->willReturn ('Simple result ' );
109109
110110 $ toolReference
@@ -141,7 +141,7 @@ public function testHandleToolCallWithComplexArguments(): void
141141 $ this ->referenceHandler
142142 ->expects ($ this ->once ())
143143 ->method ('handle ' )
144- ->with ($ toolReference , array_merge ($ arguments , ['_session ' => $ this ->session ]))
144+ ->with ($ toolReference , array_merge ($ arguments , ['_session ' => $ this ->session , ' _request ' => $ request ]))
145145 ->willReturn ('Complex result ' );
146146
147147 $ toolReference
@@ -192,7 +192,7 @@ public function testHandleToolCallExceptionReturnsResponseWithErrorResult(): voi
192192 $ this ->referenceHandler
193193 ->expects ($ this ->once ())
194194 ->method ('handle ' )
195- ->with ($ toolReference , ['param ' => 'value ' , '_session ' => $ this ->session ])
195+ ->with ($ toolReference , ['param ' => 'value ' , '_session ' => $ this ->session , ' _request ' => $ request ])
196196 ->willThrowException ($ exception );
197197
198198 $ this ->logger
@@ -227,7 +227,7 @@ public function testHandleWithNullResult(): void
227227 $ this ->referenceHandler
228228 ->expects ($ this ->once ())
229229 ->method ('handle ' )
230- ->with ($ toolReference , ['_session ' => $ this ->session ])
230+ ->with ($ toolReference , ['_session ' => $ this ->session , ' _request ' => $ request ])
231231 ->willReturn (null );
232232
233233 $ toolReference
@@ -264,7 +264,7 @@ public function testHandleLogsErrorWithCorrectParameters(): void
264264 $ this ->referenceHandler
265265 ->expects ($ this ->once ())
266266 ->method ('handle ' )
267- ->with ($ toolReference , ['key1 ' => 'value1 ' , 'key2 ' => 42 , '_session ' => $ this ->session ])
267+ ->with ($ toolReference , ['key1 ' => 'value1 ' , 'key2 ' => 42 , '_session ' => $ this ->session , ' _request ' => $ request ])
268268 ->willThrowException ($ exception );
269269
270270 $ this ->logger
@@ -274,7 +274,7 @@ public function testHandleLogsErrorWithCorrectParameters(): void
274274 'Error while executing tool "test_tool": "Custom error message". ' ,
275275 [
276276 'tool ' => 'test_tool ' ,
277- 'arguments ' => ['key1 ' => 'value1 ' , 'key2 ' => 42 , '_session ' => $ this ->session ],
277+ 'arguments ' => ['key1 ' => 'value1 ' , 'key2 ' => 42 , '_session ' => $ this ->session , ' _request ' => $ request ],
278278 ],
279279 );
280280
@@ -307,7 +307,7 @@ public function testHandleGenericExceptionReturnsError(): void
307307 $ this ->referenceHandler
308308 ->expects ($ this ->once ())
309309 ->method ('handle ' )
310- ->with ($ toolReference , ['param ' => 'value ' , '_session ' => $ this ->session ])
310+ ->with ($ toolReference , ['param ' => 'value ' , '_session ' => $ this ->session , ' _request ' => $ request ])
311311 ->willThrowException ($ exception );
312312
313313 $ response = $ this ->handler ->handle ($ request , $ this ->session );
@@ -334,7 +334,7 @@ public function testHandleWithSpecialCharactersInToolName(): void
334334 $ this ->referenceHandler
335335 ->expects ($ this ->once ())
336336 ->method ('handle ' )
337- ->with ($ toolReference , ['_session ' => $ this ->session ])
337+ ->with ($ toolReference , ['_session ' => $ this ->session , ' _request ' => $ request ])
338338 ->willReturn ('Special tool result ' );
339339
340340 $ toolReference
@@ -369,7 +369,7 @@ public function testHandleWithSpecialCharactersInArguments(): void
369369 $ this ->referenceHandler
370370 ->expects ($ this ->once ())
371371 ->method ('handle ' )
372- ->with ($ toolReference , array_merge ($ arguments , ['_session ' => $ this ->session ]))
372+ ->with ($ toolReference , array_merge ($ arguments , ['_session ' => $ this ->session , ' _request ' => $ request ]))
373373 ->willReturn ('Unicode handled ' );
374374
375375 $ toolReference
@@ -399,7 +399,7 @@ public function testHandleReturnsStructuredContentResult(): void
399399 $ this ->referenceHandler
400400 ->expects ($ this ->once ())
401401 ->method ('handle ' )
402- ->with ($ toolReference , ['query ' => 'php ' , '_session ' => $ this ->session ])
402+ ->with ($ toolReference , ['query ' => 'php ' , '_session ' => $ this ->session , ' _request ' => $ request ])
403403 ->willReturn ($ structuredResult );
404404
405405 $ toolReference
@@ -428,7 +428,7 @@ public function testHandleReturnsCallToolResult(): void
428428 $ this ->referenceHandler
429429 ->expects ($ this ->once ())
430430 ->method ('handle ' )
431- ->with ($ toolReference , ['query ' => 'php ' , '_session ' => $ this ->session ])
431+ ->with ($ toolReference , ['query ' => 'php ' , '_session ' => $ this ->session , ' _request ' => $ request ])
432432 ->willReturn ($ callToolResult );
433433
434434 $ toolReference
0 commit comments