Files
sousa-gecko/testing/web-platform/tests/webmcp/imperative/executeTool-abort.https.html
T
François Beaufort fde9dc0f7f Bug 2051409 [wpt PR 60974] - [WebMCP] Make registerTool() return a promise, a=testonly
Automatic update from web-platform-tests
[WebMCP] Make registerTool() return a promise

Spec issue: https://github.com/webmachinelearning/webmcp/issues/175

Bug: 489045948
Change-Id: I254250d12ad78b95626939e0f7e22fd6fe56f70f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7916507
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1654308}

--

wpt-commits: 925e2819ce321d53de6069f93dcf1e37171381b9
wpt-pr: 60974
2026-07-10 09:21:26 +00:00

31 lines
960 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>WebMCP executeTool with AbortSignal</title>
<link rel="author" href="mailto:dom@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(async t => {
const controller = new AbortController();
// Register a dummy tool so we have something to execute.
await document.modelContext.registerTool({
name: 'dummy_tool',
description: 'Dummy tool',
execute: async () => 'hello'
});
const tools = await document.modelContext.getTools();
const tool = tools.find(t => t.name === 'dummy_tool');
const promise = document.modelContext.executeTool(tool, '{}', { signal: controller.signal });
controller.abort();
await promise_rejects_dom(t, 'AbortError', promise, 'Promise should be rejected with AbortError');
}, 'executeTool() rejects with AbortError when signal is aborted');
</script>
</body>
</html>