ContainerAdapter
Wraps Quiote’s DI Container as the PSR-11 container mcp/sdk uses (Mcp\Server\Builder::setContainer()) to resolve string/array tool handlers (Mcp\Capability\Registry\ReferenceHandler::getClassInstance()).
Quiote’s own Container::has() deliberately reflects only explicit registrations/aliases, not autowireable classes (see its docblock) — so ordinary callers can’t observe autowiring through a PSR-11 has() check. But MCP tool/resource/prompt handler classes are typically plain autowireable classes that are never explicitly bound. If has() returned false for those, ReferenceHandler falls back to new $class(), bypassing DI (and any constructor dependencies) entirely. This adapter reports any loadable class as present so get()’s autowiring path resolves it instead.
Synopsis
Section titled “Synopsis”final class ContainerAdapter implements ContainerInterface
| Implements | ContainerInterface |
| Source | Bridge/ContainerAdapter.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(Container $container): mixed
| Parameter | Type | Description |
|---|---|---|
$container | Container |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
get(string $id): mixed | Resolves $id through the wrapped Quiote container, autowiring it when it has no explicit registration. |
has(string $id): bool | Reports whether $id can be resolved. |
public function get(string $id): mixed
Resolves $id through the wrapped Quiote container, autowiring it when it has no explicit registration.
| Parameter | Type | Description |
|---|---|---|
$id | string |
Returns mixed
public function has(string $id): bool
Reports whether $id can be resolved.
True for anything the wrapped Quiote container has an explicit registration or alias for, and additionally for any loadable class name, so mcp/sdk routes autowireable handler classes through ContainerAdapter::get() instead of instantiating them itself.
| Parameter | Type | Description |
|---|---|---|
$id | string |
Returns bool