[Server] Use getDescription to get all descriptions. (#188)

* Remove `getSummary` method and update descriptions in snapshots and code

* Add changelog entry

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
This commit is contained in:
落月 2026-01-12 05:08:05 +08:00 • committed by GitHub
commit 2c16b3e084
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -222,7 +222,7 @@ final class Discoverer implements DiscovererInterface
case McpTool::class:
$docBlock = $this->docBlockParser->parseDocBlock($method->getDocComment() ?? null);
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
$description = $instance->description ?? $this->docBlockParser->getDescription($docBlock) ?? null;
$inputSchema = $this->schemaGenerator->generate($method);
$outputSchema = $this->schemaGenerator->generateOutputSchema($method);
$tool = new Tool(
@ -241,7 +241,7 @@ final class Discoverer implements DiscovererInterface
case McpResource::class:
$docBlock = $this->docBlockParser->parseDocBlock($method->getDocComment() ?? null);
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
$description = $instance->description ?? $this->docBlockParser->getDescription($docBlock) ?? null;
$resource = new Resource(
$instance->uri,
$name,
@ -260,7 +260,7 @@ final class Discoverer implements DiscovererInterface
case McpPrompt::class:
$docBlock = $this->docBlockParser->parseDocBlock($method->getDocComment() ?? null);
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
$description = $instance->description ?? $this->docBlockParser->getDescription($docBlock) ?? null;
$arguments = [];
$paramTags = $this->docBlockParser->getParamTags($docBlock);
foreach ($method->getParameters() as $param) {
@ -280,7 +280,7 @@ final class Discoverer implements DiscovererInterface
case McpResourceTemplate::class:
$docBlock = $this->docBlockParser->parseDocBlock($method->getDocComment() ?? null);
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
$description = $instance->description ?? $this->docBlockParser->getDescription($docBlock) ?? null;
$mimeType = $instance->mimeType;
$annotations = $instance->annotations;
$meta = $instance->meta ?? null;