blob: 684e20d184e96e84949278757ac6e1f150ccb0dd [file] [edit]
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: WebMCP (https://webmachinelearning.github.io/webmcp/)
partial interface Document {
[SecureContext, SameObject] readonly attribute ModelContext modelContext;
};
[Exposed=Window, SecureContext]
interface ModelContext : EventTarget {
Promise<undefined> registerTool(ModelContextTool tool, optional ModelContextRegisterToolOptions options = {});
Promise<sequence<RegisteredTool>> getTools(optional ModelContextGetToolOptions options = {});
Promise<DOMString> executeTool(RegisteredTool tool, optional object inputObject, optional ModelContextExecuteToolOptions options = {});
attribute EventHandler ontoolchange;
attribute EventHandler ontoolactivated;
attribute EventHandler ontoolcancel;
};
dictionary ModelContextTool {
required DOMString name;
// Because `title` is for display in possibly native UIs, this must be a `USVString`.
// See https://w3ctag.github.io/design-principles/#idl-string-types.
USVString title;
required DOMString description;
object inputSchema;
required ToolExecuteCallback execute;
ToolAnnotations annotations;
};
dictionary ToolAnnotations {
boolean readOnlyHint = false;
boolean untrustedContentHint = false;
boolean consequentialHint = false;
boolean debugging = false;
};
dictionary ToolExecuteCallbackOptions {
required AbortSignal signal;
};
callback ToolExecuteCallback = Promise<any> (object inputObject, ToolExecuteCallbackOptions options);
dictionary ModelContextRegisterToolOptions {
sequence<USVString> exposedTo;
AbortSignal signal;
};
dictionary ModelContextGetToolOptions {
sequence<USVString> fromOrigins;
};
dictionary ModelContextExecuteToolOptions {
AbortSignal signal;
};
dictionary RegisteredTool {
required DOMString name;
// `title` can be exposed as a `DOMString` since it was taken in by a
// `USVString`, meaning all unmatched surrogate processing has already been
// done, and there's no need to do it again on tool exposure.
DOMString title;
required DOMString description;
object inputSchema;
required Window window;
required USVString origin;
ToolAnnotations annotations;
};
[Exposed=Window, SecureContext]
interface ToolActivatedEvent : Event {
constructor(DOMString type, optional ToolActivatedEventInit eventInitDict = {});
readonly attribute DOMString toolName;
};
dictionary ToolActivatedEventInit : EventInit {
DOMString toolName = "";
};
[Exposed=Window, SecureContext]
interface ToolCancelEvent : Event {
constructor(DOMString type, optional ToolCancelEventInit eventInitDict = {});
readonly attribute DOMString toolName;
};
dictionary ToolCancelEventInit : EventInit {
DOMString toolName = "";
};