McpTester
Rasuvaeff\Yii3Mcp\Testing\McpTester
Class — Rasuvaeff\Yii3Mcp — Source
In-process MCP client for testing application tools without HTTP or a transport process: drives the same Streamable HTTP code path the real endpoint uses (initialize handshake, session id, JSON-RPC framing) and returns decoded results.
php
$tester = new McpTester($server, $requestFactory, $responseFactory, $streamFactory);
$tester->callTool('order.status', ['orderId' => '42']);Methods
initialize()
php
initialize(): arrayPerforms the initialize handshake; called implicitly by the other methods when needed.
listTools()
php
listTools(): arraylistResources()
php
listResources(): arraylistResourceTemplates()
php
listResourceTemplates(): arraylistPrompts()
php
listPrompts(): arraycallTool()
php
callTool(string $name, array $arguments): arrayCalls a tool and returns the decoded result envelope (content, isError, structuredContent, …).
readResource()
php
readResource(string $uri): arrayrequest()
php
request(string $method, ?array $params): array