Skip to content

Commit 415c6f6

Browse files
committed
code review
1 parent 9efe7ff commit 415c6f6

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

src/Capability/Discovery/SchemaGenerator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Mcp\Capability\Discovery;
1313

1414
use Mcp\Capability\Attribute\Schema;
15+
use Mcp\Exception\BadMethodCallException;
1516
use Mcp\Exception\InvalidArgumentException;
1617
use Mcp\Server\RequestContext;
1718
use phpDocumentor\Reflection\DocBlock\Tags\Param;
@@ -71,11 +72,11 @@ public function __construct(
7172
public function generate(\Reflector $reflection): array
7273
{
7374
if ($reflection instanceof \ReflectionClass) {
74-
throw new \BadMethodCallException('Schema generation from ReflectionClass is not implemented yet. Use ReflectionMethod or ReflectionFunction instead.');
75+
throw new BadMethodCallException('Schema generation from ReflectionClass is not implemented yet. Use ReflectionMethod or ReflectionFunction instead.');
7576
}
7677

7778
if (!$reflection instanceof \ReflectionMethod && !$reflection instanceof \ReflectionFunction) {
78-
throw new \BadMethodCallException(\sprintf('Schema generation from %s is not supported. Use ReflectionMethod or ReflectionFunction instead.', $reflection::class));
79+
throw new BadMethodCallException(\sprintf('Schema generation from %s is not supported. Use ReflectionMethod or ReflectionFunction instead.', $reflection::class));
7980
}
8081

8182
$methodSchema = $this->extractMethodLevelSchema($reflection);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the official PHP MCP SDK.
5+
*
6+
* A collaboration between Symfony and the PHP Foundation.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Mcp\Exception;
13+
14+
/**
15+
* @author Antoine Bluchet <soyuka@gmail.com>
16+
*/
17+
final class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
18+
{
19+
}

src/Server/Builder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Mcp\Server;
1313

14+
use Mcp\Capability\Discovery\CachedDiscoverer;
15+
use Mcp\Capability\Discovery\Discoverer;
1416
use Mcp\Capability\Discovery\DiscovererInterface;
1517
use Mcp\Capability\Discovery\SchemaGeneratorInterface;
1618
use Mcp\Capability\Registry;
@@ -551,10 +553,10 @@ public function build(): Server
551553

552554
private function createDiscoverer(LoggerInterface $logger): DiscovererInterface
553555
{
554-
$discoverer = new \Mcp\Capability\Discovery\Discoverer($logger, null, $this->schemaGenerator);
556+
$discoverer = new Discoverer($logger, null, $this->schemaGenerator);
555557

556558
if (null !== $this->discoveryCache) {
557-
return new \Mcp\Capability\Discovery\CachedDiscoverer($discoverer, $this->discoveryCache, $logger);
559+
return new CachedDiscoverer($discoverer, $this->discoveryCache, $logger);
558560
}
559561

560562
return $discoverer;

0 commit comments

Comments
 (0)