Skip to content

Commit b1559f1

Browse files
committed
refactor: improve code formatting and consistency in discovery classes and example server
1 parent 3299288 commit b1559f1

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

examples/10-cached-discovery-stdio/server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* file that was distributed with this source code.
1313
*/
1414

15-
require_once __DIR__ . '/../bootstrap.php';
15+
require_once __DIR__.'/../bootstrap.php';
1616

1717
use Mcp\Server;
1818
use Mcp\Server\Transport\StdioTransport;

src/Capability/Discovery/CachedDiscoverer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function __construct(
3030
private readonly Discoverer $discoverer,
3131
private readonly CacheInterface $cache,
3232
private readonly LoggerInterface $logger,
33-
) {}
33+
) {
34+
}
3435

3536
/**
3637
* Discover MCP elements in the specified directories with caching.
@@ -81,7 +82,7 @@ private function generateCacheKey(string $basePath, array $directories, array $e
8182
'exclude_dirs' => $excludeDirs,
8283
];
8384

84-
return self::CACHE_PREFIX . md5(serialize($keyData));
85+
return self::CACHE_PREFIX.md5(serialize($keyData));
8586
}
8687

8788
/**

src/Capability/Discovery/Discoverer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function discover(string $basePath, array $directories, array $excludeDir
8383
$finder = new Finder();
8484
$absolutePaths = [];
8585
foreach ($directories as $dir) {
86-
$path = rtrim($basePath, '/') . '/' . ltrim($dir, '/');
86+
$path = rtrim($basePath, '/').'/'.ltrim($dir, '/');
8787
if (is_dir($path)) {
8888
$absolutePaths[] = $path;
8989
}
@@ -266,7 +266,7 @@ private function processMethod(\ReflectionMethod $method, array &$discoveredCoun
266266
if ($reflectionType instanceof \ReflectionNamedType && !$reflectionType->isBuiltin()) {
267267
continue;
268268
}
269-
$paramTag = $paramTags['$' . $param->getName()] ?? null;
269+
$paramTag = $paramTags['$'.$param->getName()] ?? null;
270270
$arguments[] = new PromptArgument($param->getName(), $paramTag ? trim((string) $paramTag->getDescription()) : null, !$param->isOptional() && !$param->isDefaultValueAvailable());
271271
}
272272
$prompt = new Prompt($name, $description, $arguments);
@@ -407,7 +407,7 @@ private function getClassFromFile(string $filePath): ?string
407407
for ($j = $i + 1; $j < $tokenCount; ++$j) {
408408
if (\is_array($tokens[$j]) && \T_STRING === $tokens[$j][0]) {
409409
$className = $tokens[$j][1];
410-
$potentialClasses[] = $namespace ? $namespace . '\\' . $className : $className;
410+
$potentialClasses[] = $namespace ? $namespace.'\\'.$className : $className;
411411
$i = $j;
412412
break;
413413
}

0 commit comments

Comments
 (0)