[Server] Add support for icons on explicit builder registration and attributes (#142)
* Add support for icons on explicit builder registration and attributes * Update docs/server-builder.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
7a8fbe9b20
commit
056c7b6103
1 changed files with 173 additions and 39 deletions
|
|
@ -222,8 +222,14 @@ class Discoverer
|
|||
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
|
||||
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
|
||||
$inputSchema = $this->schemaGenerator->generate($method);
|
||||
$meta = $instance->meta ?? null;
|
||||
$tool = new Tool($name, $inputSchema, $description, $instance->annotations, meta: $meta);
|
||||
$tool = new Tool(
|
||||
$name,
|
||||
$inputSchema,
|
||||
$description,
|
||||
$instance->annotations,
|
||||
$instance->icons,
|
||||
$instance->meta,
|
||||
);
|
||||
$tools[$name] = new ToolReference($tool, [$className, $methodName], false);
|
||||
++$discoveredCount['tools'];
|
||||
break;
|
||||
|
|
@ -232,11 +238,16 @@ class Discoverer
|
|||
$docBlock = $this->docBlockParser->parseDocBlock($method->getDocComment() ?? null);
|
||||
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
|
||||
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
|
||||
$mimeType = $instance->mimeType;
|
||||
$size = $instance->size;
|
||||
$annotations = $instance->annotations;
|
||||
$meta = $instance->meta;
|
||||
$resource = new Resource($instance->uri, $name, $description, $mimeType, $annotations, $size, $meta);
|
||||
$resource = new Resource(
|
||||
$instance->uri,
|
||||
$name,
|
||||
$description,
|
||||
$instance->mimeType,
|
||||
$instance->annotations,
|
||||
$instance->size,
|
||||
$instance->icons,
|
||||
$instance->meta,
|
||||
);
|
||||
$resources[$instance->uri] = new ResourceReference($resource, [$className, $methodName], false);
|
||||
|
||||
++$discoveredCount['resources'];
|
||||
|
|
@ -256,8 +267,7 @@ class Discoverer
|
|||
$paramTag = $paramTags['$'.$param->getName()] ?? null;
|
||||
$arguments[] = new PromptArgument($param->getName(), $paramTag ? trim((string) $paramTag->getDescription()) : null, !$param->isOptional() && !$param->isDefaultValueAvailable());
|
||||
}
|
||||
$meta = $instance->meta ?? null;
|
||||
$prompt = new Prompt($name, $description, $arguments, $meta);
|
||||
$prompt = new Prompt($name, $description, $arguments, $instance->icons, $instance->meta);
|
||||
$completionProviders = $this->getCompletionProviders($method);
|
||||
$prompts[$name] = new PromptReference($prompt, [$className, $methodName], false, $completionProviders);
|
||||
++$discoveredCount['prompts'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue