mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-29 04:31:50 +00:00
Added MCP tools to list footprints, storelocations, etc. via MCP
This commit is contained in:
parent
3056809afd
commit
f14418d889
14 changed files with 770 additions and 0 deletions
47
src/Mcp/DTO/StructuralElementOverview.php
Normal file
47
src/Mcp/DTO/StructuralElementOverview.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2026 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Mcp\DTO;
|
||||
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
/**
|
||||
* A lean overview projection of a structural "master data" element (category, footprint, manufacturer, ...),
|
||||
* used by the list_X MCP tools. Use the corresponding get_X_details tool with the id to fetch full details.
|
||||
*
|
||||
* The properties are tagged with the 'mcp_structural_overview:read' group (and the list_X mcp tools set
|
||||
* this as their normalizationContext), because otherwise the operation would silently fall back to the
|
||||
* backing entity's own (unrelated) normalization groups, which don't match these plain properties and
|
||||
* would filter them out entirely.
|
||||
*/
|
||||
readonly class StructuralElementOverview
|
||||
{
|
||||
public function __construct(
|
||||
/** @var int The database ID of the element, to be used with the corresponding get_X_details tool */
|
||||
#[Groups(['mcp_structural_overview:read'])]
|
||||
public int $id,
|
||||
/** @var string The name of the element */
|
||||
#[Groups(['mcp_structural_overview:read'])]
|
||||
public string $name,
|
||||
) {
|
||||
}
|
||||
}
|
||||
36
src/Mcp/DTO/StructuralElementSearchInput.php
Normal file
36
src/Mcp/DTO/StructuralElementSearchInput.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2026 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Mcp\DTO;
|
||||
|
||||
/**
|
||||
* Generic input for listing/searching one of the structural "master data" entities (categories, footprints,
|
||||
* manufacturers, storage locations, suppliers, measurement units, part custom states).
|
||||
*/
|
||||
readonly class StructuralElementSearchInput
|
||||
{
|
||||
public function __construct(
|
||||
/** @var string|null Optional keyword to filter by name or comment (case-insensitive substring match). If omitted, all elements are returned. */
|
||||
public ?string $keyword = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue