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
10 changes: 6 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,9 @@ is.
<dt><code><var ignore>document</var>.{{Document/modelContext}}.{{ModelContext/registerTool(tool, options)}}</code></dt>
<dd>
<p>Registers a tool that [=agents=] can invoke. Returns a rejected promise if a tool with the
same name is already registered, if the given {{ModelContextTool/name}} or
{{ModelContextTool/description}} are empty strings, or if the {{ModelContextTool/inputSchema}}
same name is already registered, if the given {{ModelContextTool/name}} is the empty string,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "if the {{ModelContextTool/name}} is invalid, if the {{ModelContextTool/description}} is empty or contains only whitespace, or if the {{ModelContextTool/inputSchema}} or {{ModelContextTool/outputSchema}} is invalid."?

if the {{ModelContextTool/description}} is empty or contains only [=ASCII whitespace=],
or if the {{ModelContextTool/inputSchema}}
or {{ModelContextTool/outputSchema}} is invalid.</p>
Comment on lines +802 to 803

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or if the {{ModelContextTool/inputSchema}}
or {{ModelContextTool/outputSchema}} is invalid.</p>
or the {{ModelContextTool/inputSchema}} or {{ModelContextTool/outputSchema}} is invalid.</p>

</dd>

Expand Down Expand Up @@ -894,8 +895,9 @@ The <dfn method for=ModelContext>registerTool(<var>tool</var>, <var>options</var
U+002D (-), or U+002E (.), then return [=a promise rejected with=] an {{InvalidStateError}}
{{DOMException}}.

1. If |tool|'s {{ModelContextTool/description}} is the empty string, then return [=a promise
rejected with=] an {{InvalidStateError}} {{DOMException}}.
1. If the result of [=strip leading and trailing ASCII whitespace|stripping leading and trailing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think* you can use [=stripping leading and trailing ASCII whitespace=] directly.

ASCII whitespace=] from |tool|'s {{ModelContextTool/description}} is the empty string, then
return [=a promise rejected with=] an {{InvalidStateError}} {{DOMException}}.

1. Let |stringified input schema| be the result of [=serializing a tool schema=] given |tool|'s
{{ModelContextTool/inputSchema}} if it [=map/exists=], and undefined otherwise. If
Expand Down