2222use Mcp \Capability \Registry \ReferenceRegistryInterface ;
2323use Mcp \Exception \ConfigurationException ;
2424use Mcp \Schema \Annotations ;
25+ use Mcp \Schema \Icon ;
2526use Mcp \Schema \Prompt ;
2627use Mcp \Schema \PromptArgument ;
2728use Mcp \Schema \Resource ;
@@ -45,7 +46,7 @@ final class ArrayLoader implements LoaderInterface
4546 * name: ?string,
4647 * description: ?string,
4748 * annotations: ?ToolAnnotations,
48- * icons: ?array<int, \Mcp\Schema\ Icon> ,
49+ * icons: ?Icon[] ,
4950 * meta: ?array<string, mixed>
5051 * }[] $tools
5152 * @param array{
@@ -56,6 +57,7 @@ final class ArrayLoader implements LoaderInterface
5657 * mimeType: ?string,
5758 * size: int|null,
5859 * annotations: ?Annotations,
60+ * icons: ?Icon[],
5961 * meta: ?array<string, mixed>
6062 * }[] $resources
6163 * @param array{
@@ -71,14 +73,15 @@ final class ArrayLoader implements LoaderInterface
7173 * handler: Handler,
7274 * name: ?string,
7375 * description: ?string,
76+ * icons: ?Icon[],
7477 * meta: ?array<string, mixed>
7578 * }[] $prompts
7679 */
7780 public function __construct (
78- private array $ tools = [],
79- private array $ resources = [],
80- private array $ resourceTemplates = [],
81- private array $ prompts = [],
81+ private readonly array $ tools = [],
82+ private readonly array $ resources = [],
83+ private readonly array $ resourceTemplates = [],
84+ private readonly array $ prompts = [],
8285 private LoggerInterface $ logger = new NullLogger (),
8386 ) {
8487 }
@@ -145,13 +148,16 @@ public function load(ReferenceRegistryInterface $registry): void
145148 $ description = $ data ['description ' ] ?? $ docBlockParser ->getSummary ($ docBlock ) ?? null ;
146149 }
147150
148- $ uri = $ data ['uri ' ];
149- $ mimeType = $ data ['mimeType ' ];
150- $ size = $ data ['size ' ];
151- $ annotations = $ data ['annotations ' ];
152- $ meta = $ data ['meta ' ];
153-
154- $ resource = new Resource ($ uri , $ name , $ description , $ mimeType , $ annotations , $ size , $ meta );
151+ $ resource = new Resource (
152+ $ data ['uri ' ],
153+ $ name ,
154+ $ description ,
155+ $ data ['mimeType ' ],
156+ $ data ['annotations ' ],
157+ $ data ['size ' ],
158+ $ data ['icons ' ],
159+ $ data ['meta ' ],
160+ );
155161 $ registry ->registerResource ($ resource , $ data ['handler ' ], true );
156162
157163 $ handlerDesc = $ this ->getHandlerDescription ($ data ['handler ' ]);
@@ -182,12 +188,14 @@ public function load(ReferenceRegistryInterface $registry): void
182188 $ description = $ data ['description ' ] ?? $ docBlockParser ->getSummary ($ docBlock ) ?? null ;
183189 }
184190
185- $ uriTemplate = $ data ['uriTemplate ' ];
186- $ mimeType = $ data ['mimeType ' ];
187- $ annotations = $ data ['annotations ' ];
188- $ meta = $ data ['meta ' ];
189-
190- $ template = new ResourceTemplate ($ uriTemplate , $ name , $ description , $ mimeType , $ annotations , $ meta );
191+ $ template = new ResourceTemplate (
192+ $ data ['uriTemplate ' ],
193+ $ name ,
194+ $ description ,
195+ $ data ['mimeType ' ],
196+ $ data ['annotations ' ],
197+ $ data ['meta ' ],
198+ );
191199 $ completionProviders = $ this ->getCompletionProviders ($ reflection );
192200 $ registry ->registerResourceTemplate ($ template , $ data ['handler ' ], $ completionProviders , true );
193201
@@ -238,8 +246,7 @@ public function load(ReferenceRegistryInterface $registry): void
238246 !$ param ->isOptional () && !$ param ->isDefaultValueAvailable (),
239247 );
240248 }
241- $ meta = $ data ['meta ' ];
242- $ prompt = new Prompt ($ name , $ description , $ arguments , $ meta );
249+ $ prompt = new Prompt ($ name , $ description , $ arguments , $ data ['icons ' ], $ data ['meta ' ]);
243250 $ completionProviders = $ this ->getCompletionProviders ($ reflection );
244251 $ registry ->registerPrompt ($ prompt , $ data ['handler ' ], $ completionProviders , true );
245252
0 commit comments