From bebe376ae7d2c4db59607b07667e4995da29b194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Fri, 27 Nov 2026 08:21:32 +0100 Subject: [PATCH] Improve waitForToolsUntil() example --- index.bs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 95d6872..42c811e 100644 --- a/index.bs +++ b/index.bs @@ -852,13 +852,14 @@ is. ```js const toolsRegistered = (async () => { const config = await fetch('/api/tools-config').then(r => r.json()); - for (const tool of config.tools) { - await document.modelContext.registerTool({ + + await Promise.allSettled(config.tools.map(tool => + document.modelContext.registerTool({ name: tool.name, description: tool.description, execute: async (input) => { /* ... */ } - }); - } + }) + )); })(); document.modelContext.waitForToolsUntil(toolsRegistered);