You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ Jen wants to create a yard sale flyer on `https://easely.example`. She wants to
105
105
-**Jen**: "Show me templates that are spring themed and that prominently feature the date and time. They should be on a white background so I don't have to print in color."
106
106
- The website has already registered the following tools:
107
107
```js
108
-
document.modelContext.registerTool({
108
+
awaitdocument.modelContext.registerTool({
109
109
name:"filter-templates",
110
110
description:"Filters the list of templates based on a natural language visual description.",
111
111
inputSchema: {
@@ -129,7 +129,7 @@ Jen wants to create a yard sale flyer on `https://easely.example`. She wants to
129
129
-**Agent**: "Done! I've created three variations of your design, each with a unique call to action."
130
130
-**Jen is ready to finalize the flyers**. Normally, she would export a PDF and find a local print shop. However, the page has also registered an `order-prints` tool:
131
131
```js
132
-
document.modelContext.registerTool({
132
+
awaitdocument.modelContext.registerTool({
133
133
name:"order-prints",
134
134
description:"Orders the current design for printing and shipping to the user.",
135
135
inputSchema: {
@@ -153,7 +153,7 @@ Maya is shopping for dresses on `http://wildebloom.example/shop`.
153
153
-**Maya**: "Show me only dresses available in my size, and also show only the ones that would be appropriate for a cocktail-attire wedding."
154
154
- The page has already registered tools to search and display products:
155
155
```js
156
-
document.modelContext.registerTool({
156
+
awaitdocument.modelContext.registerTool({
157
157
name:"get-dresses",
158
158
description:"Returns an array of product listings containing id, description, price, and photo.",
159
159
inputSchema: {
@@ -168,11 +168,11 @@ Maya is shopping for dresses on `http://wildebloom.example/shop`.
168
168
returnresponse.json();
169
169
}
170
170
});
171
-
document.modelContext.registerTool({
171
+
awaitdocument.modelContext.registerTool({
172
172
name:"show-dresses",
173
173
...
174
174
});
175
-
document.modelContext.registerTool({
175
+
awaitdocument.modelContext.registerTool({
176
176
name:"filter-products",
177
177
...
178
178
});
@@ -213,15 +213,15 @@ John is a software developer performing a code review in [Gerrit](https://www.ge
213
213
-**John**: "Why are the Mac and Android trybots failing?"
214
214
- The page has already registered the following tools:
215
215
```js
216
-
document.modelContext.registerTool({
216
+
awaitdocument.modelContext.registerTool({
217
217
name:"get-trybot-statuses",
218
218
description:"Returns the current status of all trybot runs for the active patch.",
219
219
execute() {
220
220
returnactivePatch.getStatuses();
221
221
}
222
222
});
223
223
224
-
document.modelContext.registerTool({
224
+
awaitdocument.modelContext.registerTool({
225
225
name:"get-trybot-failure-snippet",
226
226
description:"If a bot failed, returns the tail log snippet describing the error.",
227
227
inputSchema: {
@@ -260,7 +260,7 @@ A Model Context Provider registers tools by calling the `document.modelContext.r
260
260
```js
261
261
constcontroller=newAbortController();
262
262
263
-
document.modelContext.registerTool({
263
+
awaitdocument.modelContext.registerTool({
264
264
name:"add-todo",
265
265
description:"Add a new item to the user's active todo list",
266
266
inputSchema: {
@@ -321,14 +321,14 @@ By default, WebMCP is enabled in top-level `Window`s and its same-origin iframes
Calls to `document.modelContext.registerTool()` will throw a`NotAllowedError` DOMException when the permission is disabled, whether by the `allow` attribute or the `Permissions-Policy: tools=()` header. Handling of declarative tool registration errors, including when the permisssion is disabled is TBD; see [Issue #182](https://github.com/webmachinelearning/webmcp/issues/182).
324
+
Calls to `document.modelContext.registerTool()` will return a promise rejected with`NotAllowedError` DOMException when the permission is disabled, whether by the `allow` attribute or the `Permissions-Policy: tools=()` header. Handling of declarative tool registration errors, including when the permisssion is disabled is TBD; see [Issue #182](https://github.com/webmachinelearning/webmcp/issues/182).
325
325
326
326
#### Cross-origin iframe exposure: `exposedTo`
327
327
328
328
By default, tools registered by a document are only exposed to itself, same-origin documents in the same tree, and built-in browser agents (see this <ahref=#built-in-agent-default-exposure>discussion</a>). To support author-provided agents running in frames, developers can selectively share tools with secure origins of their choice, `exposedTo` option during registration:
329
329
330
330
```js
331
-
document.modelContext.registerTool({
331
+
awaitdocument.modelContext.registerTool({
332
332
name:"share-location",
333
333
description:"Returns the user's office location.",
0 commit comments