|
17 | 17 | use Symfony\AI\McpBundle\McpBundle;
|
18 | 18 | use Symfony\AI\McpSdk\Capability\Tool\IdentifierInterface;
|
19 | 19 | use Symfony\AI\McpSdk\Server\NotificationHandlerInterface;
|
| 20 | +use Symfony\AI\McpSdk\Server\RequestHandler\ToolListHandler; |
20 | 21 | use Symfony\AI\McpSdk\Server\RequestHandlerInterface;
|
21 | 22 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
22 | 23 |
|
@@ -143,6 +144,51 @@ public function testServerAutoconfigurations()
|
143 | 144 | $this->assertArrayHasKey('mcp.server.request_handler', $autoconfiguredInstances[RequestHandlerInterface::class]->getTags());
|
144 | 145 | }
|
145 | 146 |
|
| 147 | + public function testDefaultPageSizeConfiguration() |
| 148 | + { |
| 149 | + $container = $this->buildContainer([]); |
| 150 | + |
| 151 | + // Test that the default page_size parameter is set to 20 |
| 152 | + $this->assertSame(20, $container->getParameter('mcp.page_size')); |
| 153 | + |
| 154 | + // Test that ToolListHandler is registered |
| 155 | + $this->assertTrue($container->hasDefinition('mcp.server.request_handler.tool_list')); |
| 156 | + |
| 157 | + $definition = $container->getDefinition('mcp.server.request_handler.tool_list'); |
| 158 | + $this->assertSame(ToolListHandler::class, $definition->getClass()); |
| 159 | + } |
| 160 | + |
| 161 | + public function testCustomPageSizeConfiguration() |
| 162 | + { |
| 163 | + $container = $this->buildContainer([ |
| 164 | + 'mcp' => [ |
| 165 | + 'page_size' => 50, |
| 166 | + ], |
| 167 | + ]); |
| 168 | + |
| 169 | + // Test that the custom page_size parameter is set |
| 170 | + $this->assertSame(50, $container->getParameter('mcp.page_size')); |
| 171 | + } |
| 172 | + |
| 173 | + public function testMissingHandlerServices() |
| 174 | + { |
| 175 | + $container = $this->buildContainer([ |
| 176 | + 'mcp' => [ |
| 177 | + 'client_transports' => [ |
| 178 | + 'stdio' => true, |
| 179 | + 'sse' => false, |
| 180 | + ], |
| 181 | + ], |
| 182 | + ]); |
| 183 | + |
| 184 | + // Currently, only ToolListHandler is registered |
| 185 | + $this->assertTrue($container->hasDefinition('mcp.server.request_handler.tool_list')); |
| 186 | + |
| 187 | + // These services should be registered but are currently missing |
| 188 | + $this->assertFalse($container->hasDefinition('mcp.server.request_handler.resource_list')); |
| 189 | + $this->assertFalse($container->hasDefinition('mcp.server.request_handler.prompt_list')); |
| 190 | + } |
| 191 | + |
146 | 192 | private function buildContainer(array $configuration): ContainerBuilder
|
147 | 193 | {
|
148 | 194 | $container = new ContainerBuilder();
|
|
0 commit comments