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>
This commit is contained in:
41
src/Mcp/Tool/CustomField/DeleteCustomFieldValueTool.php
Normal file
41
src/Mcp/Tool/CustomField/DeleteCustomFieldValueTool.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Mcp\Tool\CustomField;
|
||||
|
||||
use App\Entity\CustomFieldValue;
|
||||
use App\Mcp\Tool\McpToolHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Mcp\Capability\Attribute\McpTool;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
|
||||
#[McpTool(
|
||||
name: 'delete_custom_field_value',
|
||||
description: 'Delete a custom field value by ID. Requires ROLE_GESTIONNAIRE.',
|
||||
)]
|
||||
class DeleteCustomFieldValueTool
|
||||
{
|
||||
use McpToolHelper;
|
||||
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly Security $security,
|
||||
) {}
|
||||
|
||||
public function __invoke(string $customFieldValueId): array
|
||||
{
|
||||
$this->requireRole($this->security, 'ROLE_GESTIONNAIRE');
|
||||
|
||||
$cfv = $this->em->getRepository(CustomFieldValue::class)->find($customFieldValueId);
|
||||
|
||||
if (null === $cfv) {
|
||||
$this->mcpError('not_found', "CustomFieldValue not found: {$customFieldValueId}");
|
||||
}
|
||||
|
||||
$this->em->remove($cfv);
|
||||
$this->em->flush();
|
||||
|
||||
return $this->jsonResponse(['deleted' => true, 'id' => $customFieldValueId]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user