141
142
public async discoverCollections(): Promise<McpCollectionDefinition[]> {
143
>
const toDiscover = this._collections.get().filter(c => c.lazy && !c.lazy.isCached);
mcpRegistry.ts
144
>
145
>
this._ongoingLazyActivations.set(this._ongoingLazyActivations.get() + 1, undefined);
146
>
await Promise.all(toDiscover.map(c => c.lazy?.load())).finally(() => {
147
>
this._ongoingLazyActivations.set(this._ongoingLazyActivations.get() - 1, undefined);
148
>
});
149
>
150
>
const found: McpCollectionDefinition[] = [];
151
>
const current = this._collections.get();
152
>
for (const collection of toDiscover) {
153
>
const rec = current.find(c => c.id === collection.id);
154
>
if (!rec) {
155
// ignored
157
rec.lazy.removed?.(); // did not get replaced by the non-lazy version
159
found.push(rec);
160
}
162
>
163
>
164
>
return found;
165
>
}
166
167
private _getInputStorage(scope: StorageScope): McpRegistryInputStorage {