addTool([new PreconfiguredGreeter('...', ...), 'greet'], 'instance_greeter')`. * * Neither the container-less `new $className()` fallback nor the auto-wiring * container can build this class, since the required `string $greeting` has no * default and is not a resolvable service. */ final class PreconfiguredGreeter { public function __construct( private readonly string $greeting, private readonly LoggerInterface $logger, ) { } /** * A tool registered as a pre-built object instance. * * @param string $name the name to greet * * @return string greeting */ public function greet(string $name): string { $this->logger->info("Instance tool 'instance_greeter' called for {$name}"); return "{$this->greeting}, {$name}!"; } }