<?php
 namespace Modules\RemoteData\Mcp\Entity; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; use Psr\Log\LoggerInterface; final class Supplier { public function __construct( private readonly \Plugins\AiAssistant\Contexts\Entity\Supplier $context, private readonly LoggerInterface $logger, private readonly \Engine\Cache\Disk $cache, ) { $this->context->setCache($this->cache); $this->logger->info('Handler `' . __CLASS__ . '` instantiated with dependencies.'); } #[McpTool(name: 'create_supplier_draft')] public function createSupplierDraft(?string $companyPrefix, ?string $company, ?string $companySuffix, ?string $alias, ?string $category, ?string $fiscalCode, ?string $regNo, ?bool $vatRegistered, ?string $vatCertificateNumber): array { $args = compact( 'companyPrefix', 'company', 'companySuffix', 'alias', 'category', 'fiscalCode', 'regNo', 'vatRegistered', 'vatCertificateNumber', ); $this->logger->info("Tool 'create_supplier_draft' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); $response = $this->context->executeMcpTool('create_supplier_draft', $args); return $response; } #[McpTool(name: 'update_supplier_draft')] public function updateSupplierDraft(?string $draft_id, ?array $patch): array { $args = compact( 'draft_id', 'patch', ); $this->logger->info("Tool 'update_supplier_draft' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); $response = $this->context->executeMcpTool('update_supplier_draft', $args); return $response; } #[McpTool(name: 'preview_supplier')] public function previewSupplier(?int $draft_id): array { $args = compact( 'draft_id' ); $this->logger->info("Tool 'preview_supplier' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); $response = $this->context->executeMcpTool('preview_supplier', $args); return $response; } #[McpTool(name: 'submit_supplier')] public function submitSupplier(?int $draft_id, ?string $user_confirmation_text): array { \App\UserAccess\CurrentUserAccessFast::getInstance()->becomeSuperUser(); $args = compact( 'draft_id', 'user_confirmation_text' ); $this->logger->info("Tool 'submit_supplier' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); $response = $this->context->executeMcpTool('submit_supplier', $args); return $response; } } 