diff --git a/index.bs b/index.bs index e602129..f0940f7 100644 --- a/index.bs +++ b/index.bs @@ -176,9 +176,12 @@ The {{ModelContext}} interface provides methods for web applications to register [Exposed=Window, SecureContext] -interface ModelContext { +interface ModelContext : EventTarget { undefined registerTool(ModelContextTool tool); undefined unregisterTool(DOMString name); + + attribute EventHandler ontoolactivated; + attribute EventHandler ontoolcancel; }; @@ -198,6 +201,13 @@ is a [=model context=] [=struct=] created alongside the {{ModelContext}}. +
+ : ontoolactivated + :: An [=event handler IDL attribute=] for the {{ModelContext/toolactivated}} event type. + : ontoolcancel + :: An [=event handler IDL attribute=] for the {{ModelContext/toolcancel}} event type. +
+
The registerTool(tool) method steps are: @@ -353,6 +363,56 @@ The requestUserInteraction(callba
+

ToolActivatedEvent Interface

+ +The {{ToolActivatedEvent}} interface represents a toolactivated event that is dispatched at {{Navigator/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 toolcancel event that is dispatched at {{Navigator/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).