diff --git a/src/mcp-bundle/tests/DependencyInjection/McpBundleTest.php b/src/mcp-bundle/tests/DependencyInjection/McpBundleTest.php index 88b8bee9..c2af6a1d 100644 --- a/src/mcp-bundle/tests/DependencyInjection/McpBundleTest.php +++ b/src/mcp-bundle/tests/DependencyInjection/McpBundleTest.php @@ -17,6 +17,7 @@ use Symfony\AI\McpBundle\McpBundle; use Symfony\AI\McpSdk\Capability\Tool\IdentifierInterface; use Symfony\AI\McpSdk\Server\NotificationHandlerInterface; +use Symfony\AI\McpSdk\Server\RequestHandler\ToolListHandler; use Symfony\AI\McpSdk\Server\RequestHandlerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -143,6 +144,51 @@ public function testServerAutoconfigurations() $this->assertArrayHasKey('mcp.server.request_handler', $autoconfiguredInstances[RequestHandlerInterface::class]->getTags()); } + public function testDefaultPageSizeConfiguration() + { + $container = $this->buildContainer([]); + + // Test that the default page_size parameter is set to 20 + $this->assertSame(20, $container->getParameter('mcp.page_size')); + + // Test that ToolListHandler is registered + $this->assertTrue($container->hasDefinition('mcp.server.request_handler.tool_list')); + + $definition = $container->getDefinition('mcp.server.request_handler.tool_list'); + $this->assertSame(ToolListHandler::class, $definition->getClass()); + } + + public function testCustomPageSizeConfiguration() + { + $container = $this->buildContainer([ + 'mcp' => [ + 'page_size' => 50, + ], + ]); + + // Test that the custom page_size parameter is set + $this->assertSame(50, $container->getParameter('mcp.page_size')); + } + + public function testMissingHandlerServices() + { + $container = $this->buildContainer([ + 'mcp' => [ + 'client_transports' => [ + 'stdio' => true, + 'sse' => false, + ], + ], + ]); + + // Currently, only ToolListHandler is registered + $this->assertTrue($container->hasDefinition('mcp.server.request_handler.tool_list')); + + // These services should be registered but are currently missing + $this->assertFalse($container->hasDefinition('mcp.server.request_handler.resource_list')); + $this->assertFalse($container->hasDefinition('mcp.server.request_handler.prompt_list')); + } + private function buildContainer(array $configuration): ContainerBuilder { $container = new ContainerBuilder();