|
32 | 32 | use ApiPlatform\Metadata\Delete; |
33 | 33 | use ApiPlatform\Metadata\Get; |
34 | 34 | use ApiPlatform\Metadata\GetCollection; |
| 35 | +use ApiPlatform\Metadata\McpTool; |
| 36 | +use ApiPlatform\Metadata\McpToolCollection; |
35 | 37 | use ApiPlatform\Metadata\Patch; |
36 | 38 | use ApiPlatform\Metadata\Post; |
37 | 39 | use ApiPlatform\Serializer\Filter\PropertyFilter; |
38 | 40 | use App\ApiPlatform\Filter\EntityFilter; |
39 | 41 | use App\ApiPlatform\Filter\LikeFilter; |
40 | 42 | use App\ApiPlatform\Filter\PartStoragelocationFilter; |
41 | 43 | use App\ApiPlatform\Filter\TagFilter; |
| 44 | +use App\DataTables\Filters\PartSearchFilter; |
42 | 45 | use App\Entity\Attachments\Attachment; |
43 | 46 | use App\Entity\Attachments\AttachmentContainingDBElement; |
44 | 47 | use App\Entity\Attachments\PartAttachment; |
|
55 | 58 | use App\Entity\Parts\PartTraits\OrderTrait; |
56 | 59 | use App\Entity\Parts\PartTraits\ProjectTrait; |
57 | 60 | use App\EntityListeners\TreeCacheInvalidationListener; |
| 61 | +use App\Mcp\DTO\ElementByIdInput; |
58 | 62 | use App\Repository\PartRepository; |
| 63 | +use App\State\Mcp\GetPartByIdProcessor; |
| 64 | +use App\State\Mcp\SearchPartsProcessor; |
59 | 65 | use App\Validator\Constraints\UniqueObjectCollection; |
60 | 66 | use Doctrine\Common\Collections\ArrayCollection; |
61 | 67 | use Doctrine\Common\Collections\Collection; |
|
104 | 110 | ], |
105 | 111 | normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read', 'part_lot:read'], 'openapi_definition_name' => 'Read'], |
106 | 112 | denormalizationContext: ['groups' => ['part:write', 'api:basic:write', 'eda_info:write', 'attachment:write', 'parameter:write'], 'openapi_definition_name' => 'Write'], |
| 113 | + mcp: [ |
| 114 | + 'search_parts' => new McpToolCollection( |
| 115 | + title: "Search parts by keyword", |
| 116 | + description: 'Search for parts', |
| 117 | + annotations: ['readOnlyHint' => true, 'destructiveHint' => false, 'idempotentHint' => true, 'openWorldHint' => false], |
| 118 | + input: PartSearchFilter::class, |
| 119 | + processor: SearchPartsProcessor::class, |
| 120 | + ), |
| 121 | + 'get_part_details' => new McpTool( |
| 122 | + title: 'Get part details by ID', |
| 123 | + description: 'Get detailed information about a specific part by its database ID', |
| 124 | + annotations: ['readOnlyHint' => true, 'destructiveHint' => false, 'idempotentHint' => true, 'openWorldHint' => false], |
| 125 | + normalizationContext: ['groups' => ['part:read', 'provider_reference:read', 'api:basic:read', 'part_lot:read', 'orderdetail:read', 'pricedetail:read', 'parameter:read', 'attachment:read', 'eda_info:read']], |
| 126 | + input: ElementByIdInput::class, |
| 127 | + processor: GetPartByIdProcessor::class |
| 128 | + ), |
| 129 | + ], |
107 | 130 | )] |
108 | 131 | #[ApiFilter(PropertyFilter::class)] |
109 | 132 | #[ApiFilter(EntityFilter::class, properties: ["category", "footprint", "manufacturer", "partUnit", "partCustomState"])] |
|
0 commit comments