forked from modelcontextprotocol/php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscoveryLoader.php
More file actions
42 lines (36 loc) · 1.03 KB
/
DiscoveryLoader.php
File metadata and controls
42 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mcp\Capability\Registry\Loader;
use Mcp\Capability\Discovery\DiscovererInterface;
use Mcp\Capability\RegistryInterface;
/**
* @internal
*
* @author Antoine Bluchet <soyuka@gmail.com>
*/
final class DiscoveryLoader implements LoaderInterface
{
/**
* @param string[] $scanDirs
* @param array|string[] $excludeDirs
*/
public function __construct(
private string $basePath,
private array $scanDirs,
private array $excludeDirs,
private DiscovererInterface $discoverer,
) {
}
public function load(RegistryInterface $registry): void
{
$discoveryState = $this->discoverer->discover($this->basePath, $this->scanDirs, $this->excludeDirs);
$registry->setDiscoveryState($discoveryState);
}
}