[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
|
|
@ -83,7 +83,7 @@ final class Builder
|
|||
* name: ?string,
|
||||
* description: ?string,
|
||||
* annotations: ?ToolAnnotations,
|
||||
* icons: ?array<int, Icon>,
|
||||
* icons: ?Icon[],
|
||||
* meta: ?array<string, mixed>
|
||||
* }[]
|
||||
*/
|
||||
|
|
@ -98,6 +98,7 @@ final class Builder
|
|||
* mimeType: ?string,
|
||||
* size: int|null,
|
||||
* annotations: ?Annotations,
|
||||
* icons: ?Icon[],
|
||||
* meta: ?array<string, mixed>
|
||||
* }[]
|
||||
*/
|
||||
|
|
@ -121,6 +122,7 @@ final class Builder
|
|||
* handler: Handler,
|
||||
* name: ?string,
|
||||
* description: ?string,
|
||||
* icons: ?Icon[],
|
||||
* meta: ?array<string, mixed>
|
||||
* }[]
|
||||
*/
|
||||
|
|
@ -316,7 +318,7 @@ final class Builder
|
|||
*
|
||||
* @param Handler $handler
|
||||
* @param array<string, mixed>|null $inputSchema
|
||||
* @param Icon[]|null $icons
|
||||
* @param ?Icon[] $icons
|
||||
* @param array<string, mixed>|null $meta
|
||||
*/
|
||||
public function addTool(
|
||||
|
|
@ -328,7 +330,15 @@ final class Builder
|
|||
?array $icons = null,
|
||||
?array $meta = null,
|
||||
): self {
|
||||
$this->tools[] = compact('handler', 'name', 'description', 'annotations', 'inputSchema', 'icons', 'meta');
|
||||
$this->tools[] = compact(
|
||||
'handler',
|
||||
'name',
|
||||
'description',
|
||||
'annotations',
|
||||
'inputSchema',
|
||||
'icons',
|
||||
'meta',
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -337,6 +347,7 @@ final class Builder
|
|||
* Manually registers a resource handler.
|
||||
*
|
||||
* @param Handler $handler
|
||||
* @param ?Icon[] $icons
|
||||
* @param array<string, mixed>|null $meta
|
||||
*/
|
||||
public function addResource(
|
||||
|
|
@ -347,9 +358,20 @@ final class Builder
|
|||
?string $mimeType = null,
|
||||
?int $size = null,
|
||||
?Annotations $annotations = null,
|
||||
?array $icons = null,
|
||||
?array $meta = null,
|
||||
): self {
|
||||
$this->resources[] = compact('handler', 'uri', 'name', 'description', 'mimeType', 'size', 'annotations', 'meta');
|
||||
$this->resources[] = compact(
|
||||
'handler',
|
||||
'uri',
|
||||
'name',
|
||||
'description',
|
||||
'mimeType',
|
||||
'size',
|
||||
'annotations',
|
||||
'icons',
|
||||
'meta',
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -383,10 +405,15 @@ final class Builder
|
|||
* Manually registers a prompt handler.
|
||||
*
|
||||
* @param Handler $handler
|
||||
* @param ?Icon[] $icons
|
||||
*/
|
||||
public function addPrompt(\Closure|array|string $handler, ?string $name = null, ?string $description = null): self
|
||||
{
|
||||
$this->prompts[] = compact('handler', 'name', 'description');
|
||||
public function addPrompt(
|
||||
\Closure|array|string $handler,
|
||||
?string $name = null,
|
||||
?string $description = null,
|
||||
?array $icons = null,
|
||||
): self {
|
||||
$this->prompts[] = compact('handler', 'name', 'description', 'icons');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue