Files
Inventory/src/Mcp/Tool/Comment/UnresolvedCountTool.php
Matthieu 4340a0e13e feat(mcp) : add business tools — search, history, comments, custom fields, documents, model types
- search_inventory: global search across all 6 entity types
- get_entity_history + get_activity_log: audit trail access
- 4 comment tools: list, create, resolve, unresolved count
- 3 custom field tools: list values, upsert, delete
- 2 document tools: list, delete (upload via REST only)
- 6 model type tools: list, get, create, update, delete, sync
- 69 MCP tests pass total

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 15:00:37 +01:00

38 lines
909 B
PHP

<?php
declare(strict_types=1);
namespace App\Mcp\Tool\Comment;
use App\Entity\Comment;
use App\Mcp\Tool\McpToolHelper;
use Doctrine\ORM\EntityManagerInterface;
use Mcp\Capability\Attribute\McpTool;
#[McpTool(
name: 'get_unresolved_comments_count',
description: 'Get the total count of unresolved (open) comments across all entities.',
)]
class UnresolvedCountTool
{
use McpToolHelper;
public function __construct(
private readonly EntityManagerInterface $em,
) {}
public function __invoke(): array
{
$count = (int) $this->em->getRepository(Comment::class)
->createQueryBuilder('c')
->select('COUNT(c.id)')
->andWhere('c.status = :status')
->setParameter('status', 'open')
->getQuery()
->getSingleScalarResult()
;
return $this->jsonResponse(['count' => $count]);
}
}