Added MCP tools to access info provider features

This commit is contained in:
Jan Böhmer 2026-07-20 22:07:06 +02:00
parent a3fe7ea591
commit 7e53c7ae9a
14 changed files with 708 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?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\Validator\Constraints as Assert;
readonly class InfoProviderPartDetailsInput
{
public function __construct(
/** @var string The key of the info provider (e.g. "digikey", "mouser", "lcsc"), as returned by search_info_providers */
#[Assert\NotBlank]
public string $provider_key,
/** @var string The provider-specific ID of the part, as returned by search_info_providers */
#[Assert\NotBlank]
public string $provider_id,
) {
}
}

View file

@ -0,0 +1,41 @@
<?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\Validator\Constraints as Assert;
readonly class InfoProviderSearchInput
{
public function __construct(
/** @var string The keyword to search for (e.g. a part name, manufacturer product number or GTIN) */
#[Assert\NotBlank]
public string $keyword,
/**
* @var string[]|null The keys of the info providers to search in (e.g. "digikey", "mouser", "lcsc"). If not
* given, the default search providers configured in the system settings are used.
*/
#[Assert\All([new Assert\Type('string')])]
public ?array $providers = null,
) {
}
}

View file

@ -0,0 +1,30 @@
<?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;
/**
* This tool takes no parameters, it just lists the currently available info providers.
*/
readonly class ListInfoProvidersInput
{
}