<?php
 namespace Modules\RemoteData\Mcp\ReportsData; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; use Psr\Log\LoggerInterface; final class CorporateOffices { public function __construct( private readonly \Plugins\AiAssistant\Contexts\ReportsData\CorporateOffices $corporateOfficesContext, private readonly LoggerInterface $logger, ) { $this->logger->info('Handler `'.__CLASS__.'` instantiated with dependencies.'); } #[McpTool(name: 'list_corporate_offices')] public function listCorporateOffices(?array $filters, ?array $metrics, ?string $sort_by, ?string $sort_order, ?string $limit, ?string $sum_by): array { $args = [ 'filters' => $filters, 'metrics' => $metrics, 'sort_by' => $sort_by, 'sort_order' => $sort_order, 'limit' => $limit, 'sum_by' => $sum_by, ]; $listObj = new \App\ReportsData\EntityList\CorporateOffices(); $listObj->setFilter('corpOffice.deleted', '=', 0); $listObj->setFilter('corp.deleted', '=', 0); $response = $this->corporateOfficesContext->executeReportsDataEntitylist('rd_corporateOffices', $listObj, $args); $output = []; $output['results'] = $response; $output['count'] = $listObj->getRecordsCount(); $this->logger->info("Tool 'list_corporate_offices' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); return $output; } } 