Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,20 @@ The <dfn method for=ModelContext>registerTool(<var>tool</var>, <var>options</var
</ol>
</div>

1. Let |exposed origins| be an empty [=list=] of [=origins=].

1. If |options|'s {{ModelContextRegisterToolOptions/exposedTo}} [=map/exists=], then:

1. [=list/For each=] |origin| of |options|'s {{ModelContextRegisterToolOptions/exposedTo}}:

1. Let |parsedURL| be the result of running the [=URL parser=] on |origin|.

1. If |parsedURL| is failure or its [=url/origin=] is not [$is origin potentially
trustworthy?|potentially trustworthy$], then return [=a promise rejected with=] a
"{{SecurityError}}" {{DOMException}}.

1. [=list/Append=] |parsedURL|'s [=url/origin=] to |exposed origins|.

1. Let |promise| be [=a new promise=] created in [=this=]'s [=relevant realm=].

1. If |options|'s {{ModelContextRegisterToolOptions/signal}} [=map/exists=], then:
Expand All @@ -422,20 +436,6 @@ The <dfn method for=ModelContext>registerTool(<var>tool</var>, <var>options</var

1. [=Reject=] |promise| with |signal|'s [=AbortSignal/abort reason=].

1. Let |exposed origins| be an empty [=list=] of [=origins=].

1. If |options|'s {{ModelContextRegisterToolOptions/exposedTo}} [=map/exists=], then:

1. [=list/For each=] |origin| of |options|'s {{ModelContextRegisterToolOptions/exposedTo}}:

1. Let |parsedURL| be the result of running the [=URL parser=] on |origin|.

1. If |parsedURL| is failure or its [=url/origin=] is not [$is origin potentially
trustworthy?|potentially trustworthy$], then return [=a promise rejected with=] a
"{{SecurityError}}" {{DOMException}}.

1. [=list/Append=] |parsedURL|'s [=url/origin=] to |exposed origins|.

1. Let |tool definition| be a new [=tool definition=], with the following [=struct/items=]:

: [=tool definition/name=]
Expand Down Expand Up @@ -669,17 +669,17 @@ definition itself.

<xmp class="idl">
dictionary ModelContextRegisterToolOptions {
AbortSignal signal;
sequence<USVString> exposedTo;
AbortSignal signal;
};
</xmp>

<dl class="domintro">
: <code><var ignore>options</var>["{{ModelContextRegisterToolOptions/exposedTo}}"]</code>
:: An array of origins that control which documents this tool is exposed to, in the current document's tree.

: <code><var ignore>options</var>["{{ModelContextRegisterToolOptions/signal}}"]</code>
:: An {{AbortSignal}} that unregisters the tool when aborted.

: <code><var ignore>options</var>["{{ModelContextRegisterToolOptions/exposedTo}}"]</code>
:: <p>An array of origins that control which documents this tool is exposed to, in the current document's tree.
</dl>

<h4 id="model-context-get-tool-options">ModelContextGetToolOptions Dictionary</h4>
Expand Down
Loading