<?php
 namespace Modules\RemoteData\Mcp\ReportsData; use Mcp\Capability\Attribute\McpResource; use Mcp\Capability\Attribute\McpTool; use Psr\Log\LoggerInterface; final class Trusts { public function __construct( private readonly \Plugins\AiAssistant\Contexts\ReportsData\Trusts $trustsContext, private readonly LoggerInterface $logger, ) { $this->logger->info('Handler `'.__CLASS__.'` instantiated with dependencies.'); } #[McpTool(name: 'list_trusts')] public function listTrusts(?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\Trusts(); $listObj->setFilter('trusts.deleted', '=', 0); $response = $this->trustsContext->executeReportsDataEntitylist('rd_trusts', $listObj, $args); $output = []; $output['results'] = $response; $output['count'] = $listObj->getRecordsCount(); $this->logger->info("Tool 'list_trusts' invoked", ['args' => new \Engine\Logger\Context\ArrayAssoc($args), ]); return $output; } } 