[Server] Keep injectable parameters out of the published inputSchema (#482)
This commit is contained in:
parent
ff0b5fadc8
commit
e173367c5f
1 changed files with 156 additions and 18 deletions
|
|
@ -13,8 +13,6 @@ namespace Mcp\Capability\Registry;
|
|||
|
||||
use Mcp\Exception\InvalidArgumentException;
|
||||
use Mcp\Exception\RegistryException;
|
||||
use Mcp\Server\ClientGateway;
|
||||
use Mcp\Server\RequestContext;
|
||||
use Mcp\Server\Session\SessionInterface;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
|
@ -106,15 +104,9 @@ final class ReferenceHandler implements ReferenceHandlerInterface
|
|||
// Check if parameter is a special injectable type
|
||||
$type = $parameter->getType();
|
||||
if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) {
|
||||
$typeName = $type->getName();
|
||||
|
||||
if (RequestContext::class === $typeName && isset($arguments['_session'], $arguments['_request'])) {
|
||||
$finalArgs[$paramPosition] = new RequestContext($arguments['_session'], $arguments['_request']);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ClientGateway::class === $typeName && isset($arguments['_session'])) {
|
||||
$finalArgs[$paramPosition] = new ClientGateway($arguments['_session']);
|
||||
$injected = InjectableParameters::resolve($type->getName(), $arguments);
|
||||
if (null !== $injected) {
|
||||
$finalArgs[$paramPosition] = $injected;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue