blob: 12c9c1ac5e3a2bcc150c7627cbd25bc0a434ea37 [file]
<!DOCTYPE html>
<html>
<head>
<title>WebMCP tool registered after asynchronous work</title>
<script>
document.modelContext.registerTool({
name: 'initial_tool',
description: 'Registered while the document is parsed',
execute: async () => 'initial_tool result',
});
const asyncWork = new Promise(resolve => window.finishAsyncWork = resolve);
window.toolsRegistered = asyncWork.then(
() => document.modelContext.registerTool({
name: 'deferred_tool',
description: 'Registered after asynchronous work completes',
execute: async () => 'deferred_tool result',
}));
document.modelContext.waitForToolsUntil(window.toolsRegistered);
</script>
</head>
<body>
</body>
</html>