Skip to content

Commit b584484

Browse files
committed
Test existing pagination configuration in McpBundleTest
This extends the existing McpBundleTest with tests that verify: - The default page_size parameter (20) is correctly set - Custom page_size configuration works properly - ResourceListHandler and PromptListHandler services are not yet registered The tests show that pagination configuration is already implemented in the bundle through the page_size parameter, which defaults to 20 and can be customized via bundle configuration.
1 parent 59f1422 commit b584484

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/mcp-bundle/tests/DependencyInjection/McpBundleTest.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\AI\McpBundle\McpBundle;
1818
use Symfony\AI\McpSdk\Capability\Tool\IdentifierInterface;
1919
use Symfony\AI\McpSdk\Server\NotificationHandlerInterface;
20+
use Symfony\AI\McpSdk\Server\RequestHandler\ToolListHandler;
2021
use Symfony\AI\McpSdk\Server\RequestHandlerInterface;
2122
use Symfony\Component\DependencyInjection\ContainerBuilder;
2223

@@ -143,6 +144,51 @@ public function testServerAutoconfigurations()
143144
$this->assertArrayHasKey('mcp.server.request_handler', $autoconfiguredInstances[RequestHandlerInterface::class]->getTags());
144145
}
145146

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+
146192
private function buildContainer(array $configuration): ContainerBuilder
147193
{
148194
$container = new ContainerBuilder();

0 commit comments

Comments
 (0)