[Server] Add Bidirectional Client Communication Support (#109)
* feat(server): add bidirectional client communication support * fix(server): use correct session ID string conversion method * fix: clean up docblocks for request handler methods in Builder * fix: merge artifacts
This commit is contained in:
parent
0963d243bc
commit
f1b471a219
1 changed files with 1973 additions and 445 deletions
|
|
@ -13,6 +13,7 @@ namespace Mcp\Capability\Registry;
|
|||
|
||||
use Mcp\Exception\InvalidArgumentException;
|
||||
use Mcp\Exception\RegistryException;
|
||||
use Mcp\Server\ClientGateway;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -89,6 +90,17 @@ final class ReferenceHandler implements ReferenceHandlerInterface
|
|||
$paramName = $parameter->getName();
|
||||
$paramPosition = $parameter->getPosition();
|
||||
|
||||
// Check if parameter is a special injectable type
|
||||
$type = $parameter->getType();
|
||||
if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) {
|
||||
$typeName = $type->getName();
|
||||
|
||||
if (ClientGateway::class === $typeName && isset($arguments['_session'])) {
|
||||
$finalArgs[$paramPosition] = new ClientGateway($arguments['_session']);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arguments[$paramName])) {
|
||||
$argument = $arguments[$paramName];
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue