🚨 WebMCP API change: we’re preparing to go from Origin Trial into GA, so we’re making final changes that affect the API shape now.
Our newest update in WebMCP: getTools() now returns Tool objects instead of plain dictionaries.
Before this, executeTool() looked tools up by name. If a page unregistered a tool and registered a new one with the same name between getTools() and executeTool(), you'd silently run the new tool with arguments meant for the old one. Now each Tool points to that exact registration under the hood, so a stale reference rejects with NotFoundError instead:
const tools = await document.modelContext.getTools();
const addToCart = tools.find((t) => http://t.name === "add_to_cart");
// page unregisters "add_to_cart" and registers a new one with an updated schema
await document.modelContext.executeTool(addToCart, { sku: "JKT-4821", quantity: 1 });
// rejects with NotFoundError (re-fetch with getTools())
Because Tool is a real interface now, you also can't pass a hand-built object to executeTool(). It has to come from getTools().
A few migration details to watch for:
・tool.window is now tool.source, and it's null if the document that registered it goes away
・omitted inputSchema, outputSchema, and annotations are null instead of undefined
https://github.com/webmachinelearning/webmcp/pull/348
Join the early preview program to stay up to date with changes: http://goo.gle/join-epp