@@ -290,7 +290,10 @@ To <dfn>cancel a pending tool execution</dfn> given a [=traversable navigable=]
290290 1. [=AbortController/signal abort|Signal abort=] on |localExecution|'s [=local pending tool
291291 execution/abort controller=] .
292292
293- Issue(#146): Fire the "toolcanceled" event at |targetDocument|'s relevant global object.
293+ 1. [=Fire an event=] named {{ModelContext/toolcancel}} at |targetDocument|'s
294+ [=Document/associated ModelContext|associated <code>ModelContext</code>=] , using
295+ {{ToolCancelEvent}} , with its {{ToolCancelEvent/toolName}} attribute initialized to
296+ |execution|'s [=pending tool execution/tool name=] .
294297
295298</div>
296299
@@ -485,7 +488,9 @@ internal value=] |uuid|, are as follows:
4854881. If |inputObject| [=Object type|is not an Object=] is false, then run |completionSteps| given null
486489 and false, and abort these steps.
487490
488- Issue(#146): Specify and fire the "<code> toolactivated</code> " event.
491+ 1. [=Fire an event=] named {{ModelContext/toolactivated}} at |targetDocument|'s [=Document/associated
492+ ModelContext|associated <code>ModelContext</code>=] , using {{ToolActivatedEvent}} , with its
493+ {{ToolActivatedEvent/toolName}} attribute initialized to |tool|'s {{ModelContextTool/name}} .
489494
4904951. Let |controller| be a [=new=] {{AbortController}} created in |targetDocument|'s [=relevant
491496 realm=] .
@@ -614,6 +619,8 @@ interface ModelContext : EventTarget {
614619 Promise<DOMString> executeTool(RegisteredTool tool, optional any inputObject, optional ModelContextExecuteToolOptions options = {});
615620
616621 attribute EventHandler ontoolchange;
622+ attribute EventHandler ontoolactivated;
623+ attribute EventHandler ontoolcancel;
617624};
618625</xmp>
619626
@@ -1331,8 +1338,58 @@ that must be supported, as [=event handler IDL attributes=], by all {{ModelConte
13311338 <tr>
13321339 <td> <dfn attribute for="ModelContext">ontoolchange</dfn>
13331340 <td> <dfn event for="ModelContext">toolchange</dfn>
1341+ <tr>
1342+ <td> <dfn attribute for="ModelContext">ontoolactivated</dfn>
1343+ <td> <dfn event for="ModelContext">toolactivated</dfn>
1344+ <tr>
1345+ <td> <dfn attribute for="ModelContext">ontoolcancel</dfn>
1346+ <td> <dfn event for="ModelContext">toolcancel</dfn>
13341347</table>
13351348
1349+ <h4 id="tool-activated-event">ToolActivatedEvent Interface</h4>
1350+
1351+ The {{ToolActivatedEvent}} interface represents a {{ModelContext/toolactivated}} event that is
1352+ dispatched at a {{ModelContext}} object when the execution of a tool begins.
1353+
1354+ <xmp class="idl">
1355+ [Exposed=Window, SecureContext]
1356+ interface ToolActivatedEvent : Event {
1357+ constructor(DOMString type, optional ToolActivatedEventInit eventInitDict = {});
1358+ readonly attribute DOMString toolName;
1359+ };
1360+
1361+ dictionary ToolActivatedEventInit : EventInit {
1362+ DOMString toolName = "";
1363+ };
1364+ </xmp>
1365+
1366+ <dl class="domintro" dfn-type=attribute dfn-for=ToolActivatedEvent>
1367+ : <dfn>toolName</dfn>
1368+ :: Returns the name of the tool whose execution has started.
1369+ </dl>
1370+
1371+ <h4 id="tool-cancel-event">ToolCancelEvent Interface</h4>
1372+
1373+ The {{ToolCancelEvent}} interface represents a {{ModelContext/toolcancel}} event that is dispatched
1374+ at a {{ModelContext}} object when the execution of a tool is cancelled.
1375+
1376+ <xmp class="idl">
1377+ [Exposed=Window, SecureContext]
1378+ interface ToolCancelEvent : Event {
1379+ constructor(DOMString type, optional ToolCancelEventInit eventInitDict = {});
1380+ readonly attribute DOMString toolName;
1381+ };
1382+
1383+ dictionary ToolCancelEventInit : EventInit {
1384+ DOMString toolName = "";
1385+ };
1386+ </xmp>
1387+
1388+ <dl class="domintro" dfn-type=attribute dfn-for=ToolCancelEvent>
1389+ : <dfn>toolName</dfn>
1390+ :: Returns the name of the tool whose execution was cancelled.
1391+ </dl>
1392+
13361393<h3 id="permissions-policy">Permissions policy integration</h3>
13371394
13381395Access to the APIs in this specification is gated behind the [=policy-controlled feature=] "<dfn
0 commit comments