The imperative execute steps fire toolactivated before invoking the tool's execute callback.
Chromium and WPT both do it the other way around:
Proposal: move the step after the call to execute, and add a guard:
1. Let |toolPromise| be the result of [=invoke|invoking=] |tool|'s {{ModelContextTool/execute}} with
|inputObject| and |options|.
+1. [=Fire an event=] named {{ModelContext/toolactivated}} at |targetDocument|'s [=Document/associated
+ ModelContext|associated <code>ModelContext</code>=], using {{ToolActivatedEvent}}, with its
+ {{ToolActivatedEvent/toolName}} attribute initialized to |tool|'s {{ModelContextTool/name}}.
+
1. [=promise/React=] to |toolPromise|:
Related: #126, #245.
The imperative execute steps fire
toolactivatedbefore invoking the tool'sexecutecallback.Chromium and WPT both do it the other way around:
executeTool-abort.https.htmlexpects['tool started', 'toolactivated', …].executeTool-detach-toolactivated.https.htmlexpects no event afterexecutedetaches the document.Proposal: move the step after the call to
execute, and add a guard:1. Let |toolPromise| be the result of [=invoke|invoking=] |tool|'s {{ModelContextTool/execute}} with |inputObject| and |options|. +1. [=Fire an event=] named {{ModelContext/toolactivated}} at |targetDocument|'s [=Document/associated + ModelContext|associated <code>ModelContext</code>=], using {{ToolActivatedEvent}}, with its + {{ToolActivatedEvent/toolName}} attribute initialized to |tool|'s {{ModelContextTool/name}}. + 1. [=promise/React=] to |toolPromise|:Related: #126, #245.