@@ -105,18 +105,21 @@ public function testToolList(): void
105105 $ this ->assertArrayNotHasKey ('isError ' , $ resultContent );
106106
107107 $ this ->assertArrayHasKey ('tools ' , $ resultContent );
108- $ this ->assertCount (3 , $ resultContent ['tools ' ]);
108+ $ this ->assertCount (4 , $ resultContent ['tools ' ]);
109109
110110 $ tools = $ resultContent ['tools ' ];
111111
112112 $ this ->assertSame ('create_user ' , $ tools [0 ]['name ' ]);
113113 $ this ->assertSame ('Creates a user based on the provided data ' , $ tools [0 ]['description ' ]);
114114
115- $ this ->assertSame ('multiply_numbers ' , $ tools [1 ]['name ' ]);
116- $ this ->assertSame ('Calculates the product of two numbers ' , $ tools [1 ]['description ' ]);
115+ $ this ->assertSame ('date_time ' , $ tools [1 ]['name ' ]);
116+ $ this ->assertSame ('Retrieve the date and time of the server ' , $ tools [1 ]['description ' ]);
117117
118- $ this ->assertSame ('sum_numbers ' , $ tools [2 ]['name ' ]);
119- $ this ->assertSame ('Calculates the sum of two numbers ' , $ tools [2 ]['description ' ]);
118+ $ this ->assertSame ('multiply_numbers ' , $ tools [2 ]['name ' ]);
119+ $ this ->assertSame ('Calculates the product of two numbers ' , $ tools [2 ]['description ' ]);
120+
121+ $ this ->assertSame ('sum_numbers ' , $ tools [3 ]['name ' ]);
122+ $ this ->assertSame ('Calculates the sum of two numbers ' , $ tools [3 ]['description ' ]);
120123
121124 $ this ->assertArrayHasKey ('inputSchema ' , $ tools [0 ]);
122125 $ this ->assertSame ([
@@ -149,6 +152,9 @@ public function testToolList(): void
149152 ], $ tools [0 ]['annotations ' ]);
150153
151154 $ this ->assertArrayHasKey ('inputSchema ' , $ tools [1 ]);
155+ $ this ->assertSame ([], $ tools [1 ]['inputSchema ' ]);
156+
157+ $ this ->assertArrayHasKey ('inputSchema ' , $ tools [2 ]);
152158 $ this ->assertSame ([
153159 'type ' => 'object ' ,
154160 'properties ' => [
@@ -163,18 +169,18 @@ public function testToolList(): void
163169 'nullable ' => false ,
164170 ],
165171 ],
166- ], $ tools [1 ]['inputSchema ' ]);
172+ ], $ tools [2 ]['inputSchema ' ]);
167173
168- $ this ->assertArrayHasKey ('annotations ' , $ tools [1 ]);
174+ $ this ->assertArrayHasKey ('annotations ' , $ tools [2 ]);
169175 $ this ->assertSame ([
170176 'title ' => 'Multiply Numbers ' ,
171177 'readOnlyHint ' => true ,
172178 'destructiveHint ' => false ,
173179 'idempotentHint ' => false ,
174180 'openWorldHint ' => false ,
175- ], $ tools [1 ]['annotations ' ]);
181+ ], $ tools [2 ]['annotations ' ]);
176182
177- $ this ->assertArrayHasKey ('inputSchema ' , $ tools [2 ]);
183+ $ this ->assertArrayHasKey ('inputSchema ' , $ tools [3 ]);
178184 $ this ->assertSame ([
179185 'type ' => 'object ' ,
180186 'properties ' => [
@@ -189,16 +195,16 @@ public function testToolList(): void
189195 'nullable ' => false ,
190196 ],
191197 ],
192- ], $ tools [2 ]['inputSchema ' ]);
198+ ], $ tools [3 ]['inputSchema ' ]);
193199
194- $ this ->assertArrayHasKey ('annotations ' , $ tools [2 ]);
200+ $ this ->assertArrayHasKey ('annotations ' , $ tools [3 ]);
195201 $ this ->assertSame ([
196202 'title ' => '' ,
197203 'readOnlyHint ' => false ,
198204 'destructiveHint ' => true ,
199205 'idempotentHint ' => false ,
200206 'openWorldHint ' => true ,
201- ], $ tools [2 ]['annotations ' ]);
207+ ], $ tools [3 ]['annotations ' ]);
202208 }
203209
204210 /**
@@ -231,6 +237,40 @@ public function testToolCallWithNonExistingTool(): void
231237 ], $ responseContent );
232238 }
233239
240+ public function testToolCallWithNoParameters (): void
241+ {
242+ $ response = $ this ->request (
243+ method: Request::METHOD_POST ,
244+ url: '/mcp ' ,
245+ body: [
246+ 'jsonrpc ' => '2.0 ' ,
247+ 'id ' => 1 ,
248+ 'method ' => 'tools/call ' ,
249+ 'params ' => [
250+ 'name ' => 'date_time ' ,
251+ ],
252+ ],
253+ );
254+
255+ $ responseContent = json_decode ((string ) $ response ->getContent (), true );
256+ $ this ->assertNotFalse ($ responseContent );
257+
258+ $ this ->assertArrayHasKey ('result ' , $ responseContent );
259+
260+ $ result = $ responseContent ['result ' ];
261+
262+ $ this ->assertArrayHasKey ('content ' , $ result );
263+ $ content = $ result ['content ' ];
264+
265+ $ this ->assertCount (1 , $ content );
266+
267+ $ content0 = $ content [0 ];
268+ $ this ->assertSame ('text ' , $ content0 ['type ' ]);
269+ $ dateTime = $ content0 ['text ' ];
270+
271+ $ this ->assertEqualsWithDelta (new \DateTime (), new \DateTime ($ dateTime ), 1 );
272+ }
273+
234274 /**
235275 * @covers ::entrypointAction
236276 * @covers \Ecourty\McpServerBundle\MethodHandler\ToolsCallMethodHandler
@@ -360,9 +400,10 @@ public function testPromptList(): void
360400 $ resultContent = $ responseContent ['result ' ];
361401
362402 $ this ->assertArrayHasKey ('prompts ' , $ resultContent );
363- $ this ->assertCount (2 , $ resultContent ['prompts ' ]);
403+ $ this ->assertCount (3 , $ resultContent ['prompts ' ]);
364404
365405 $ prompts = $ resultContent ['prompts ' ];
406+
366407 $ this ->assertSame ('generate-git-commit-message ' , $ prompts [0 ]['name ' ]);
367408 $ this ->assertSame ('Generate a git commit message based on the provided changes. ' , $ prompts [0 ]['description ' ]);
368409 $ this ->assertArrayHasKey ('arguments ' , $ prompts [0 ]);
@@ -381,6 +422,10 @@ public function testPromptList(): void
381422 $ this ->assertSame ('name ' , $ prompts [1 ]['arguments ' ][0 ]['name ' ]);
382423 $ this ->assertSame ('The name of the person to greet. ' , $ prompts [1 ]['arguments ' ][0 ]['description ' ]);
383424 $ this ->assertFalse ($ prompts [1 ]['arguments ' ][0 ]['required ' ]);
425+
426+ $ this ->assertSame ('say_hello ' , $ prompts [2 ]['name ' ]);
427+ $ this ->assertSame ('Says hello ' , $ prompts [2 ]['description ' ]);
428+ $ this ->assertArrayNotHasKey ('arguments ' , $ prompts [2 ]);
384429 }
385430
386431 public function testPromptGet (): void
@@ -434,6 +479,41 @@ public function testPromptGet(): void
434479 $ this ->assertStringContainsString ($ scope , $ content ['text ' ]);
435480 }
436481
482+ public function testPromptGetWithoutArguments (): void
483+ {
484+ $ response = $ this ->request (
485+ method: Request::METHOD_POST ,
486+ url: '/mcp ' ,
487+ body: [
488+ 'jsonrpc ' => '2.0 ' ,
489+ 'id ' => 1 ,
490+ 'method ' => 'prompts/get ' ,
491+ 'params ' => [
492+ 'name ' => 'say_hello ' ,
493+ ],
494+ ],
495+ );
496+
497+ $ responseContent = json_decode ((string ) $ response ->getContent (), true );
498+
499+ $ this ->assertSame ([
500+ 'jsonrpc ' => '2.0 ' ,
501+ 'id ' => 1 ,
502+ 'result ' => [
503+ 'description ' => 'Says hello ' ,
504+ 'messages ' => [
505+ [
506+ 'role ' => 'system ' ,
507+ 'content ' => [
508+ 'type ' => 'text ' ,
509+ 'text ' => 'Hello! ' ,
510+ ],
511+ ],
512+ ],
513+ ],
514+ ], $ responseContent );
515+ }
516+
437517 public function testPromptGetWithNonRequiredParameterLeftEmpty (): void
438518 {
439519 $ response = $ this ->request (
0 commit comments