diff --git a/index.bs b/index.bs index 491d9e8..bb715a1 100644 --- a/index.bs +++ b/index.bs @@ -333,6 +333,8 @@ interface ModelContext : EventTarget { undefined registerTool(ModelContextTool tool, optional ModelContextRegisterToolOptions options = {}); attribute EventHandler ontoolchange; + attribute EventHandler ontoolactivated; + attribute EventHandler ontoolcancel; }; @@ -589,6 +591,56 @@ The requestUserInteraction(callba +

ToolActivatedEvent Interface

+ +The {{ToolActivatedEvent}} interface represents a {{ModelContext/toolactivated}} event that is dispatched at {{ModelContext}} when a tool is invoked by an [=agent=]. + + +[Exposed=Window, SecureContext] +interface ToolActivatedEvent : Event { + constructor(DOMString type, optional ToolActivatedEventInit eventInitDict = {}); + readonly attribute DOMString toolName; + readonly attribute Element? element; +}; + +dictionary ToolActivatedEventInit : EventInit { + DOMString toolName = ""; + Element? element = null; +}; + + +
+ : toolName + :: Returns the name of the tool that was activated. + : element + :: Returns the form element associated with the tool, if any. +
+ +

ToolCancelEvent Interface

+ +The {{ToolCancelEvent}} interface represents a {{ModelContext/toolcancel}} event that is dispatched at {{ModelContext}} when a tool's invocation is canceled by an [=agent=]. + + +[Exposed=Window, SecureContext] +interface ToolCancelEvent : Event { + constructor(DOMString type, optional ToolCancelEventInit eventInitDict = {}); + readonly attribute DOMString toolName; + readonly attribute Element? element; +}; + +dictionary ToolCancelEventInit : EventInit { + DOMString toolName = ""; + Element? element = null; +}; + + +
+ : toolName + :: Returns the name of the tool that was canceled. + : element + :: Returns the form element associated with the tool, if any. +
+

Declarative WebMCP

This section is entirely a TODO. For now, refer to the [explainer draft](https://github.com/webmachinelearning/webmcp/pull/76). @@ -631,6 +683,12 @@ that must be supported, as [=event handler IDL attributes=], by all {{ModelConte ontoolchange toolchange + + ontoolactivated + toolactivated + + ontoolcancel + toolcancel

Permissions policy integration