@orkestrate/agent-webmcp 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -41
- package/bin/agent-webmcp.js +66 -0
- package/bin/check.js +23 -0
- package/package.json +12 -36
- package/CHANGELOG.md +0 -20
- package/LICENSE +0 -21
- package/dist/cli.js +0 -17514
- package/init.js +0 -259
- package/registry/index.json +0 -1
- package/registry/sites/README.md +0 -8
- package/registry/sites/docs.stripe.com.js +0 -65
- package/skills/agent-webmcp/SKILL.md +0 -63
- package/skills/agent-webmcp/references/authoring.md +0 -50
- package/skills/agent-webmcp/references/drivers.md +0 -43
package/init.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
/* agent-webmcp init.js v0 — passive WebMCP registry only.
|
|
2
|
-
* No browser driving, no network, no DOM writes.
|
|
3
|
-
* - Defines document.modelContext + navigator.modelContext if absent.
|
|
4
|
-
* - Wraps native executeTool to accept object AND string (routes around
|
|
5
|
-
* anomalyco/browse#121 on stable: string in, parse, run).
|
|
6
|
-
* - window.webmcp facade for execute code-mode: list/call/define.
|
|
7
|
-
* Self-contained IIFE: safe for addInitScript, --init-script, eval. */
|
|
8
|
-
(function () {
|
|
9
|
-
"use strict";
|
|
10
|
-
var root = typeof window !== "undefined" ? window : globalThis;
|
|
11
|
-
var doc = typeof document !== "undefined" ? document : null;
|
|
12
|
-
if (!doc) return;
|
|
13
|
-
|
|
14
|
-
function normalizeInput(input) {
|
|
15
|
-
if (typeof input === "string") {
|
|
16
|
-
try { return JSON.parse(input); } catch (e) { throw new Error("Failed to parse input arguments"); }
|
|
17
|
-
}
|
|
18
|
-
return input === undefined || input === null ? {} : input;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// window.webmcp.<toolName> shorthands, bound at register time so the
|
|
22
|
-
// snippets `get` emits actually resolve. Never shadows list/call/define.
|
|
23
|
-
function bindShorthand(name) {
|
|
24
|
-
try {
|
|
25
|
-
var wm = root.webmcp;
|
|
26
|
-
if (!wm || typeof name !== "string") return;
|
|
27
|
-
if (name === "list" || name === "call" || name === "define") return;
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(wm, name)) return;
|
|
29
|
-
Object.defineProperty(wm, name, {
|
|
30
|
-
value: function (input, opts) { return wm.call(name, input === undefined ? {} : input, opts); },
|
|
31
|
-
configurable: true,
|
|
32
|
-
enumerable: true,
|
|
33
|
-
});
|
|
34
|
-
} catch (e) {}
|
|
35
|
-
}
|
|
36
|
-
function unbindShorthand(name) {
|
|
37
|
-
try {
|
|
38
|
-
var wm = root.webmcp;
|
|
39
|
-
if (!wm || typeof name !== "string") return;
|
|
40
|
-
if (name === "list" || name === "call" || name === "define") return;
|
|
41
|
-
try { delete wm[name]; } catch (e) {}
|
|
42
|
-
} catch (e) {}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function makeRegistry(native) {
|
|
46
|
-
var tools = new Map();
|
|
47
|
-
// Native handles: Chrome 157+ executeTool takes the registered tool
|
|
48
|
-
// object, not its name. Cache name -> handle at register time, since
|
|
49
|
-
// native getTools() is opaque and pre-existing tools are unresolvable.
|
|
50
|
-
var handles = new Map();
|
|
51
|
-
var listeners = new Set();
|
|
52
|
-
function emit() {
|
|
53
|
-
var evt;
|
|
54
|
-
try { evt = new Event("toolchange"); } catch (e) { evt = { type: "toolchange" }; }
|
|
55
|
-
listeners.forEach(function (fn) { try { fn(evt); } catch (e) {} });
|
|
56
|
-
if (doc.dispatchEvent) { try { doc.dispatchEvent(new Event("webmcp:toolchange")); } catch (e) {} }
|
|
57
|
-
}
|
|
58
|
-
var registry = {
|
|
59
|
-
registerTool: function (tool, opts) {
|
|
60
|
-
if (!tool || typeof tool.name !== "string") throw new Error("registerTool needs {name}");
|
|
61
|
-
if (native) {
|
|
62
|
-
var r = native.registerTool.call(native, tool, opts);
|
|
63
|
-
try {
|
|
64
|
-
var p = Promise.resolve(r).then(function () { return native.getTools.call(native); }).then(function (list) {
|
|
65
|
-
var arr = Array.isArray(list) ? list : [];
|
|
66
|
-
for (var i = 0; i < arr.length; i++) {
|
|
67
|
-
try { if (arr[i] && arr[i].name === tool.name) { handles.set(tool.name, arr[i]); return arr[i]; } } catch (e) {}
|
|
68
|
-
}
|
|
69
|
-
handles.set(tool.name, tool);
|
|
70
|
-
return tool;
|
|
71
|
-
}, function () { return tool; });
|
|
72
|
-
handles.set(tool.name, p);
|
|
73
|
-
} catch (e) {}
|
|
74
|
-
bindShorthand(tool.name);
|
|
75
|
-
emit();
|
|
76
|
-
if (opts && opts.signal) {
|
|
77
|
-
if (opts.signal.aborted) { try { registry.unregisterTool(tool.name); } catch (e) {} }
|
|
78
|
-
else opts.signal.addEventListener("abort", function () { try { registry.unregisterTool(tool.name); } catch (e) {} }, { once: true });
|
|
79
|
-
}
|
|
80
|
-
return r;
|
|
81
|
-
}
|
|
82
|
-
tools.set(tool.name, tool);
|
|
83
|
-
bindShorthand(tool.name);
|
|
84
|
-
emit();
|
|
85
|
-
if (opts && opts.signal) {
|
|
86
|
-
if (opts.signal.aborted) { tools.delete(tool.name); unbindShorthand(tool.name); }
|
|
87
|
-
else opts.signal.addEventListener("abort", function () { tools.delete(tool.name); unbindShorthand(tool.name); emit(); }, { once: true });
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
unregisterTool: function (name) {
|
|
91
|
-
if (native && native.unregisterTool) { var r = native.unregisterTool.call(native, name); unbindShorthand(name); emit(); return r; }
|
|
92
|
-
var ok = tools.delete(name);
|
|
93
|
-
if (ok) { unbindShorthand(name); emit(); }
|
|
94
|
-
return ok;
|
|
95
|
-
},
|
|
96
|
-
getTools: function () {
|
|
97
|
-
if (native) {
|
|
98
|
-
// Opaque upstream: report what we cached at register time.
|
|
99
|
-
// Tools registered before this script loaded are not visible here.
|
|
100
|
-
return Array.from(handles.values()).map(function (t) {
|
|
101
|
-
var c = { name: t.name };
|
|
102
|
-
if (typeof t.description === "string") c.description = t.description;
|
|
103
|
-
return c;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return Array.from(tools.values()).map(function (t) {
|
|
107
|
-
var c = {};
|
|
108
|
-
for (var k in t) if (k !== "execute" && Object.prototype.hasOwnProperty.call(t, k)) c[k] = t[k];
|
|
109
|
-
return c;
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
executeTool: async function (name, input) {
|
|
113
|
-
var args = normalizeInput(input);
|
|
114
|
-
if (native) {
|
|
115
|
-
// Resolve the registered handle first: native takes the tool
|
|
116
|
-
// object, not its name. Uncached names fall through to a
|
|
117
|
-
// name call for older implementations.
|
|
118
|
-
var handle = null;
|
|
119
|
-
try { handle = handles.get(name) || null; } catch (e) {}
|
|
120
|
-
if (handle !== null && typeof handle.then === "function") {
|
|
121
|
-
try { handle = await handle; } catch (e) { handle = null; }
|
|
122
|
-
}
|
|
123
|
-
if (handle === null) {
|
|
124
|
-
try {
|
|
125
|
-
var relist = await native.getTools.call(native);
|
|
126
|
-
var arr = Array.isArray(relist) ? relist : [];
|
|
127
|
-
for (var i = 0; i < arr.length; i++) {
|
|
128
|
-
try { if (arr[i] && arr[i].name === name) { handle = arr[i]; handles.set(name, handle); break; } } catch (e) {}
|
|
129
|
-
}
|
|
130
|
-
} catch (e) {}
|
|
131
|
-
}
|
|
132
|
-
var target = handle !== null ? handle : name;
|
|
133
|
-
var out;
|
|
134
|
-
try { out = await native.executeTool.call(native, target, args); }
|
|
135
|
-
catch (e) {
|
|
136
|
-
var msg = String((e && e.message) || e);
|
|
137
|
-
if (/not of type ['"]?object['"]?|Failed to parse input arguments/i.test(msg) && typeof input !== "string") {
|
|
138
|
-
out = await native.executeTool.call(native, target, JSON.stringify(args));
|
|
139
|
-
} else throw e;
|
|
140
|
-
}
|
|
141
|
-
if (typeof out === "string") {
|
|
142
|
-
try { return JSON.parse(out); } catch (e) { return out; }
|
|
143
|
-
}
|
|
144
|
-
return out;
|
|
145
|
-
}
|
|
146
|
-
var tool = tools.get(name);
|
|
147
|
-
if (!tool) throw new Error("unknown tool: " + name);
|
|
148
|
-
if (typeof tool.execute !== "function") throw new Error("tool has no execute: " + name);
|
|
149
|
-
return await tool.execute(args);
|
|
150
|
-
},
|
|
151
|
-
addEventListener: function (type, fn) { if (type === "toolchange") listeners.add(fn); },
|
|
152
|
-
removeEventListener: function (type, fn) { if (type === "toolchange") listeners.delete(fn); },
|
|
153
|
-
};
|
|
154
|
-
return registry;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
var nativeCtx = doc.modelContext || (typeof navigator !== "undefined" && navigator.modelContext) || null;
|
|
158
|
-
var hasNativeExecute = !!(nativeCtx && typeof nativeCtx.executeTool === "function");
|
|
159
|
-
var registry = makeRegistry(hasNativeExecute ? nativeCtx : null);
|
|
160
|
-
|
|
161
|
-
try {
|
|
162
|
-
if (!doc.modelContext) Object.defineProperty(doc, "modelContext", { value: registry, configurable: true, writable: true });
|
|
163
|
-
else if (hasNativeExecute && !doc.modelContext.__awLenient) {
|
|
164
|
-
// Chrome 157 native: registerTool/getTools are async, and
|
|
165
|
-
// executeTool takes the tool handle (with .origin filled in), not
|
|
166
|
-
// its name. Cache name -> handle at register time by re-listing.
|
|
167
|
-
var seen = {};
|
|
168
|
-
var origReg = doc.modelContext.registerTool.bind(doc.modelContext);
|
|
169
|
-
var origList = doc.modelContext.getTools.bind(doc.modelContext);
|
|
170
|
-
var origExec = doc.modelContext.executeTool.bind(doc.modelContext);
|
|
171
|
-
var findHandle = async function (name) {
|
|
172
|
-
try {
|
|
173
|
-
var list = await origList();
|
|
174
|
-
var arr = Array.isArray(list) ? list : [];
|
|
175
|
-
for (var i = 0; i < arr.length; i++) {
|
|
176
|
-
try { if (arr[i] && arr[i].name === name) return arr[i]; } catch (e) {}
|
|
177
|
-
}
|
|
178
|
-
} catch (e) {}
|
|
179
|
-
return null;
|
|
180
|
-
};
|
|
181
|
-
doc.modelContext.registerTool = function (tool, opts) {
|
|
182
|
-
var r = origReg(tool, opts);
|
|
183
|
-
try {
|
|
184
|
-
if (tool && typeof tool.name === "string") {
|
|
185
|
-
var p = Promise.resolve(r).then(function () { return findHandle(tool.name); }).then(function (h) {
|
|
186
|
-
seen[tool.name] = h || tool;
|
|
187
|
-
return seen[tool.name];
|
|
188
|
-
}, function () { return tool; });
|
|
189
|
-
seen[tool.name] = p;
|
|
190
|
-
bindShorthand(tool.name);
|
|
191
|
-
if (opts && opts.signal) {
|
|
192
|
-
var onAbort = function () { try { delete seen[tool.name]; } catch (e) {} unbindShorthand(tool.name); };
|
|
193
|
-
if (opts.signal.aborted) onAbort();
|
|
194
|
-
else opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
} catch (e) {}
|
|
198
|
-
return r;
|
|
199
|
-
};
|
|
200
|
-
doc.modelContext.executeTool = async function (name, input) {
|
|
201
|
-
var args = normalizeInput(input);
|
|
202
|
-
var cached = (seen !== null && Object.prototype.hasOwnProperty.call(seen, name)) ? seen[name] : null;
|
|
203
|
-
if (cached !== null && typeof cached.then === "function") {
|
|
204
|
-
try { cached = await cached; } catch (e) { cached = null; }
|
|
205
|
-
}
|
|
206
|
-
if (cached === null) {
|
|
207
|
-
try { cached = await findHandle(name); } catch (e) { cached = null; }
|
|
208
|
-
if (cached !== null) { try { seen[name] = cached; } catch (e) {} }
|
|
209
|
-
}
|
|
210
|
-
var target = cached !== null ? cached : name;
|
|
211
|
-
var out;
|
|
212
|
-
try { out = await origExec(target, args); }
|
|
213
|
-
catch (e) {
|
|
214
|
-
var m2 = String((e && e.message) || e);
|
|
215
|
-
if (/not of type ['"]?object['"]?|Failed to parse input arguments/i.test(m2) && typeof input !== "string") {
|
|
216
|
-
out = await origExec(target, JSON.stringify(args));
|
|
217
|
-
} else throw e;
|
|
218
|
-
}
|
|
219
|
-
if (typeof out === "string") {
|
|
220
|
-
try { return JSON.parse(out); } catch (e) { return out; }
|
|
221
|
-
}
|
|
222
|
-
return out;
|
|
223
|
-
};
|
|
224
|
-
Object.defineProperty(doc.modelContext, "__awLenient", { value: true, configurable: true });
|
|
225
|
-
doc.modelContext.getTools = function () {
|
|
226
|
-
var names = Object.keys(seen);
|
|
227
|
-
if (names.length > 0) {
|
|
228
|
-
return Promise.resolve(names.map(function (n) {
|
|
229
|
-
var t = seen[n];
|
|
230
|
-
var c = { name: n };
|
|
231
|
-
if (t && typeof t.description === "string") c.description = t.description;
|
|
232
|
-
return c;
|
|
233
|
-
}));
|
|
234
|
-
}
|
|
235
|
-
try { return origList(); } catch (e) { return Promise.resolve([]); }
|
|
236
|
-
};
|
|
237
|
-
["registerTool", "getTools"].forEach(function (k) {
|
|
238
|
-
if (typeof registry[k] === "function" && typeof doc.modelContext[k] !== "function") {
|
|
239
|
-
try { doc.modelContext[k] = registry[k]; } catch (e) {}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
} catch (e) {}
|
|
244
|
-
try {
|
|
245
|
-
if (typeof navigator !== "undefined" && !navigator.modelContext) {
|
|
246
|
-
Object.defineProperty(navigator, "modelContext", { value: doc.modelContext, configurable: true });
|
|
247
|
-
}
|
|
248
|
-
} catch (e) {}
|
|
249
|
-
|
|
250
|
-
var mc = doc.modelContext;
|
|
251
|
-
var facade = {
|
|
252
|
-
list: function () { return mc.getTools(); },
|
|
253
|
-
call: function (name, args) { return mc.executeTool(name, args === undefined ? {} : args); },
|
|
254
|
-
define: function (tool) { mc.registerTool(tool); return tool.name; },
|
|
255
|
-
};
|
|
256
|
-
try {
|
|
257
|
-
if (!root.webmcp) Object.defineProperty(root, "webmcp", { value: facade, configurable: true, writable: true });
|
|
258
|
-
} catch (e) { root.webmcp = facade; }
|
|
259
|
-
})();
|
package/registry/index.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version": 1, "updatedAt": "2026-11-08T00:00:00Z", "domains": {"upstash.com": {"domain": "upstash.com", "entryUrl": "https://upstash.com/docs", "platform": null, "script": null, "updatedAt": "2026-11-08T00:00:00Z", "tools": [{"name": "ask_docs", "source": "native", "description": "Ask this documentation site a question. Returns the pages and sections that answer it.", "inputSchema": {"type": "object", "properties": {"query": {"type": "string", "description": "A question, or the words and API names to find in this documentation site.", "minLength": 1, "maxLength": 256}}, "required": ["query"], "additionalProperties": false}, "annotations": {"readOnlyHint": true}}, {"name": "rate_page", "source": "native", "description": "Tell the documentation owner if this page helped with your task. Say what helped, or what was missing or wrong, in the comment. Do not send code, secrets or personal data.", "inputSchema": {"type": "object", "properties": {"helpful": {"type": "boolean", "description": "True if the page helped, false if it did not."}, "comment": {"type": "string", "description": "What helped, or what was missing or wrong. Required when helpful is false.", "maxLength": 500}}, "required": ["helpful"], "additionalProperties": false}, "annotations": {"readOnlyHint": false}}, {"name": "request_feature", "source": "native", "description": "Ask the product for a feature that the user's task needs and the documentation does not have. Search the documentation first. A title that the list already has counts as a vote. Do not send code, secrets or personal data.", "inputSchema": {"type": "object", "properties": {"title": {"type": "string", "description": "Names the feature.", "minLength": 3, "maxLength": 120}, "reason": {"type": "string", "description": "What the user tried to do.", "maxLength": 600}}, "required": ["title", "reason"], "additionalProperties": false}, "annotations": {"readOnlyHint": false}}]}, "allbirds.com": {"domain": "allbirds.com", "entryUrl": "https://www.allbirds.com", "platform": "shopify", "script": null, "updatedAt": "2026-11-08T00:00:00Z", "tools": [{"name": "ask_business", "source": "native", "description": "Ask the store a question about its policies and services: returns, refunds and exchanges, shipping and delivery, privacy, terms, subscriptions, contact details and opening hours, or FAQ topics such as gift wrapping. Read-only: it does not change the cart, place orders, or start returns. For products, prices and availability, use search_catalog or get_product.", "inputSchema": {"type": "object", "required": ["ask"], "properties": {"ask": {"type": "object", "description": "The question and optional buyer context.", "required": ["query"], "properties": {"query": {"type": "string", "maxLength": 10000, "description": "The shopper's question, in natural language."}, "context": {"type": "object", "description": "Optional buyer context, such as the shopper's country or language. Send only what the question needs.", "additionalProperties": true, "properties": {}}}}}}, "annotations": {"readOnlyHint": true}}, {"name": "browse_store", "source": "native", "description": "Browse OR navigate to store collections. Set navigate=true whenever the user wants to be taken to a collection page in the browser. With navigate=false (default), returns collection or product data without changing the page. Without a collection handle, lists all collections.", "inputSchema": {"type": "object", "properties": {"collection": {"type": "string", "description": "Collection handle to browse. Omit to list all collections."}, "navigate": {"type": "boolean", "description": "When true, navigate the browser to the collection page. Defaults to false."}, "sort_by": {"type": "string", "description": "Sort order, e.g. best-selling, price-ascending."}, "page": {"type": "number", "description": "Page number for pagination (starts at 1)."}}}, "annotations": {"readOnlyHint": false}}, {"name": "cancel_cart", "source": "native", "description": "Remove all items from the cart in one step. Use when the user wants to empty their cart or start over.", "inputSchema": {"type": "object", "properties": {}}, "annotations": {"readOnlyHint": false}}, {"name": "create_cart", "source": "native", "description": "Create the shopper's cart with the given items, for a shopper whose cart has no items yet. Each line item names a ProductVariant GID and a quantity. When the cart already has items, nothing is created or changed.", "inputSchema": {"type": "object", "required": ["cart"], "properties": {"cart": {"type": "object", "required": ["line_items"], "properties": {"line_items": {"type": "array", "description": "The items the new cart holds.", "minItems": 1, "maxItems": 100, "items": {"type": "object"}}}}}}, "annotations": {"readOnlyHint": false}}, {"name": "get_cart", "source": "native", "description": "Get the shopper's current cart: its id, every line (line id, product and variant titles, variant id, handle, URL, image, unit price, quantity, line price) and the totals. Works from any page.", "inputSchema": {"type": "object", "properties": {}}, "annotations": {"readOnlyHint": true}}, {"name": "get_product", "source": "native", "description": "Get product details, OR navigate the browser to the product page. Set catalog.navigate=true whenever the user wants to see/view the product in the browser. Defaults to the current page's product if no catalog.id is provided. Does NOT add anything to the cart.", "inputSchema": {"type": "object", "properties": {"catalog": {"type": "object", "description": "Product detail parameters.", "properties": {"id": {"type": "string", "description": "Storefront API Product GID, product handle, or product URL path."}, "navigate": {"type": "boolean", "description": "When true, navigate the browser to the product page. Defaults to false."}, "selected_options": {"type": "array", "description": "Known product option selections to filter available_options.", "items": {"type": "object", "properties": {}, "required": ["name", "value"]}}}}}}, "annotations": {"readOnlyHint": false}}, {"name": "get_ucp_profile", "source": "native", "description": "Get this store's Universal Commerce Protocol (UCP) profile, as served at /.well-known/ucp: the UCP version, the services the store offers with their endpoints, its capabilities, and its payment handlers. Read-only; works from any page.", "inputSchema": {"type": "object", "properties": {}}, "annotations": {"readOnlyHint": true}}, {"name": "manage_orders", "source": "native", "description": "Navigate to the customer's order history page. Use when the user asks about past orders, order status, tracking, or returns. The user will be prompted to log in if not already authenticated.", "inputSchema": {"type": "object", "properties": {}}, "annotations": {"readOnlyHint": false}}, {"name": "proceed_to_checkout", "source": "native", "description": "Proceed to checkout. Verifies the cart is not empty, then MOVES the browser to the checkout page. The tool result confirms the destination, and no further navigation is needed to show it.", "inputSchema": {"type": "object", "properties": {}}, "annotations": {"readOnlyHint": false, "consequentialHint": true}}, {"name": "search_catalog", "source": "native", "description": "Search the store catalog for products, collections, articles, and pages. Does NOT add anything to the cart; use create_cart or update_cart for cart changes. Each product carries variant_id, its selected or first available variant.", "inputSchema": {"type": "object", "required": ["catalog"], "properties": {"catalog": {"type": "object", "required": ["query"], "properties": {"query": {"type": "string", "description": "Search query string."}}}}}}, {"name": "show_variant", "source": "native", "description": "Navigate the browser to a product page, with a specific variant OR a partial option filter selected. Accepts EITHER variant_id OR selected_options. Does NOT add anything to the cart. This MOVES the browser to the exact variant page.", "inputSchema": {"type": "object", "required": ["catalog"], "properties": {"catalog": {"type": "object", "description": "Provide EITHER variant_id OR selected_options.", "properties": {"handle": {"type": "string", "description": "Product handle. If omitted, uses the current product page's handle."}, "variant_id": {"type": ["string", "number"], "description": "ProductVariant ID from get_product."}, "selected_options": {"type": "array", "description": "Partial (or full) option selections.", "items": {"type": "object"}}}}}}, "annotations": {"readOnlyHint": false}}, {"name": "update_cart", "source": "native", "description": "Set the shopper's cart to exactly the given line items. This is a full replacement, not a patch. An empty line_items list empties the cart; leaving line_items out leaves the lines as they are.", "inputSchema": {"type": "object", "required": ["cart"], "properties": {"id": {"type": "string", "description": "Optional cart id; a mismatch changes nothing."}, "cart": {"type": "object", "properties": {"line_items": {"type": "array", "description": "The complete set of lines the cart holds afterwards.", "maxItems": 100, "items": {"type": "object"}}}}}}}]}, "docs.stripe.com": {"domain": "docs.stripe.com", "entryUrl": "https://docs.stripe.com/", "platform": null, "script": "sites/docs.stripe.com.js", "updatedAt": "2026-11-08T00:00:00Z", "tools": [{"name": "ask_ai", "source": "custom", "description": "Ask the Stripe docs AI assistant a question. Returns the markdown answer. Use for how-to, API behavior, and concept questions about Stripe.", "inputSchema": {"type": "object", "required": ["question"], "properties": {"question": {"type": "string", "description": "Technical question about Stripe."}}}, "annotations": {"readOnlyHint": true}}]}}}
|
package/registry/sites/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# registry/sites/
|
|
2
|
-
|
|
3
|
-
Curated custom per-site scripts (raw `registerTool` bodies, no polyfill
|
|
4
|
-
header — `get`/`save` prepend it at compile time).
|
|
5
|
-
|
|
6
|
-
Phase 2 seeds native-only domains, so this directory starts empty on
|
|
7
|
-
purpose: every file here must be a hand- or agent-authored tool with a
|
|
8
|
-
proven live run behind it. No unverified scripts.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Custom tools for docs.stripe.com (agent-webmcp Phase 3: ask_ai hybrid).
|
|
2
|
-
// The site ships no native WebMCP tools. This drives the built-in
|
|
3
|
-
// Stripe Assistant drawer: open -> ask -> wait for stream settle -> answer.
|
|
4
|
-
|
|
5
|
-
document.modelContext.registerTool({
|
|
6
|
-
name: "ask_ai",
|
|
7
|
-
description: "Ask the Stripe docs AI assistant a question. Returns the markdown answer. Use for how-to, API behavior, and concept questions about Stripe.",
|
|
8
|
-
inputSchema: {
|
|
9
|
-
type: "object",
|
|
10
|
-
required: ["question"],
|
|
11
|
-
properties: {
|
|
12
|
-
question: { type: "string", description: "Technical question about Stripe." }
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
annotations: { readOnlyHint: true },
|
|
16
|
-
execute: async ({ question }) => {
|
|
17
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
18
|
-
const openDrawer = async () => {
|
|
19
|
-
if (document.getElementById("StripeAssistant")) return;
|
|
20
|
-
const btn = document.querySelector('[data-testid="StripeAssistant--Header-AskAI"]');
|
|
21
|
-
if (!btn) throw new Error("Stripe Assistant button not found on this page");
|
|
22
|
-
btn.click();
|
|
23
|
-
for (let i = 0; i < 40; i++) {
|
|
24
|
-
if (document.getElementById("StripeAssistant")) return;
|
|
25
|
-
await sleep(250);
|
|
26
|
-
}
|
|
27
|
-
throw new Error("Stripe Assistant drawer did not open");
|
|
28
|
-
};
|
|
29
|
-
const settle = async (getText, { quietMs = 1500, timeoutMs = 45000, minChars = 40 } = {}) => {
|
|
30
|
-
let last = "";
|
|
31
|
-
let stableSince = Date.now();
|
|
32
|
-
const deadline = Date.now() + timeoutMs;
|
|
33
|
-
while (Date.now() < deadline) {
|
|
34
|
-
const text = String(getText() || "").trim();
|
|
35
|
-
if (text !== last) {
|
|
36
|
-
last = text;
|
|
37
|
-
stableSince = Date.now();
|
|
38
|
-
} else if (text.length >= minChars && Date.now() - stableSince >= quietMs) {
|
|
39
|
-
return text;
|
|
40
|
-
}
|
|
41
|
-
await sleep(300);
|
|
42
|
-
}
|
|
43
|
-
if (last.length >= minChars) return last;
|
|
44
|
-
throw new Error("Assistant answer did not settle in time");
|
|
45
|
-
};
|
|
46
|
-
await openDrawer();
|
|
47
|
-
const root = document.getElementById("StripeAssistant");
|
|
48
|
-
const ta = root.querySelector("textarea");
|
|
49
|
-
if (!ta) throw new Error("Assistant input not found");
|
|
50
|
-
const setter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value").set;
|
|
51
|
-
setter.call(ta, String(question));
|
|
52
|
-
ta.dispatchEvent(new Event("input", { bubbles: true }));
|
|
53
|
-
ta.dispatchEvent(new Event("change", { bubbles: true }));
|
|
54
|
-
await sleep(400);
|
|
55
|
-
for (const type of ["keydown", "keypress"]) {
|
|
56
|
-
ta.dispatchEvent(new KeyboardEvent(type, { key: "Enter", code: "Enter", keyCode: 13, bubbles: true }));
|
|
57
|
-
}
|
|
58
|
-
const answer = await settle(() => {
|
|
59
|
-
const el = document.getElementById("StripeAssistant");
|
|
60
|
-
return el ? el.innerText : "";
|
|
61
|
-
});
|
|
62
|
-
const lines = answer.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
63
|
-
return { answer: lines.join("\n"), lines: lines.length };
|
|
64
|
-
}
|
|
65
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agent-webmcp
|
|
3
|
-
description: >
|
|
4
|
-
Turn the web into a callable toolkit for your browser driver. Use when a task needs an external service, docs, store, or web app: search the index, load site tools via get, execute in one call, save the miss.
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# agent-webmcp — toolkit-first web access
|
|
8
|
-
|
|
9
|
-
`agent-webmcp` is a capability index plus a `document.modelContext` /
|
|
10
|
-
`window.webmcp` polyfill. It never touches the browser. Your driver owns
|
|
11
|
-
tabs; this skill decides which tool to call before any snapshot.
|
|
12
|
-
|
|
13
|
-
Rule: toolkit-first. Run search, then get. Snapshot only on a toolkit miss.
|
|
14
|
-
|
|
15
|
-
CLI: `agent-webmcp`. Fallback when the binary is not on PATH: prefix every
|
|
16
|
-
command with `npx -y @orkestrate/agent-webmcp`.
|
|
17
|
-
|
|
18
|
-
## 1. Search the index
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
agent-webmcp search "<intent or domain>" [--domain D] [--source native|custom] [--limit N]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Done when: search returns a match for the task, or returns empty and the
|
|
25
|
-
task still needs the site. Empty is a decision, not a failure — continue
|
|
26
|
-
to get.
|
|
27
|
-
|
|
28
|
-
## 2. Fetch the site toolkit
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
agent-webmcp get <domain>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Done when: get returns `entry_url`, `init_script`, a `tools` list, and
|
|
35
|
-
`how_to_run`. The `inputSchema` values are the only valid arguments.
|
|
36
|
-
|
|
37
|
-
Unindexed domains still return `init_script` plus a `hint`. The polyfill
|
|
38
|
-
exposes live native tools on the page even with zero indexed tools.
|
|
39
|
-
|
|
40
|
-
## 3. Execute through your driver
|
|
41
|
-
|
|
42
|
-
Follow the `how_to_run` block that get returned for the active driver.
|
|
43
|
-
Full playbooks live in `references/drivers.md` — load only the active
|
|
44
|
-
driver's section.
|
|
45
|
-
|
|
46
|
-
Done when: the tool returns its result, or the driver reports
|
|
47
|
-
auth/2FA/confirmation and a human completes it first. The toolkit reads
|
|
48
|
-
the page; the driver performs anything consequential.
|
|
49
|
-
|
|
50
|
-
## 4. Persist the miss
|
|
51
|
-
|
|
52
|
-
When no tool covered the task and driver primitives solved it, save the
|
|
53
|
-
flow so the next visit is one call. Contract and skeleton live in
|
|
54
|
-
`references/authoring.md`.
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
agent-webmcp save <domain> <file.js> [--entry-url <url>]
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Done when: save prints `saved <domain> (<tools>) -> <bundle>` and a
|
|
61
|
-
repeat `get <domain>` lists the new tool.
|
|
62
|
-
|
|
63
|
-
Only `sync` touches the network. Everything else reads local files.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Authoring a site toolkit
|
|
2
|
-
|
|
3
|
-
`save` sandboxes the file, captures `registerTool` calls, and never runs
|
|
4
|
-
`execute()`. One file can register several tools.
|
|
5
|
-
|
|
6
|
-
Contract (enforced at save time):
|
|
7
|
-
|
|
8
|
-
- `document.modelContext.registerTool({...})` runs synchronously at top level.
|
|
9
|
-
- Each tool needs `name` (string) and `execute` (function). Missing
|
|
10
|
-
either fails the save.
|
|
11
|
-
- `inputSchema` is optional (defaults to open object). `description` and
|
|
12
|
-
`annotations` are optional but indexed, so write them.
|
|
13
|
-
- Max file size 200KB.
|
|
14
|
-
|
|
15
|
-
Skeleton:
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
document.modelContext.registerTool({
|
|
19
|
-
name: "tool_name",
|
|
20
|
-
description: "What it does and what it returns.",
|
|
21
|
-
inputSchema: {
|
|
22
|
-
type: "object",
|
|
23
|
-
required: ["query"],
|
|
24
|
-
properties: { query: { type: "string" } },
|
|
25
|
-
},
|
|
26
|
-
annotations: { readOnlyHint: true },
|
|
27
|
-
execute: async ({ query }) => {
|
|
28
|
-
// Plain DOM only. All waiting lives inside execute().
|
|
29
|
-
const el = document.querySelector("textarea, input[type=text]");
|
|
30
|
-
if (!el) return { ok: false, error: "input not found" };
|
|
31
|
-
el.focus();
|
|
32
|
-
const setter = Object.getPrototypeOf(el).constructor === HTMLTextAreaElement
|
|
33
|
-
? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value").set
|
|
34
|
-
: Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set;
|
|
35
|
-
setter.call(el, query);
|
|
36
|
-
el.dispatchEvent(new Event("input", { bubbles: true }));
|
|
37
|
-
return { ok: true, query };
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Then:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
agent-webmcp save <domain> <file.js> [--entry-url <url>]
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Done when: save prints `saved <domain> (<tools>) -> <bundle>` and
|
|
49
|
-
`get <domain>` lists the new tool. Save stubs and paywalls as warnings
|
|
50
|
-
returned by execute, never as tools.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Driver playbooks
|
|
2
|
-
|
|
3
|
-
Follow the `how_to_run` block from `get`. These are the full versions.
|
|
4
|
-
Load only the section for the driver in use.
|
|
5
|
-
|
|
6
|
-
## OpenCode Browse (execute realm)
|
|
7
|
-
|
|
8
|
-
Script-tag and init-script injection are dead in this realm — mount the
|
|
9
|
-
polyfill as an evaluated expression, in the same block as the call.
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
await page.goto(URL, { waitUntil: 'domcontentloaded' });
|
|
13
|
-
await page.evaluate(INIT_SOURCE); // init.js bytes of the init_script path (`agent-webmcp init --stdout`)
|
|
14
|
-
const tools = await page.evaluate(() => window.webmcp.list());
|
|
15
|
-
return await page.evaluate((args) => window.webmcp.TOOL(args), { /* schema args */ });
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
`window.webmcp.call(name, args)` works where a shorthand is awkward.
|
|
19
|
-
`handoff()` for logins/2FA/confirmation, then re-call.
|
|
20
|
-
|
|
21
|
-
Done when: the call returns the tool result.
|
|
22
|
-
|
|
23
|
-
## agent-browser
|
|
24
|
-
|
|
25
|
-
`--init-script` registers before the 1-second discovery window.
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
agent-browser --init-script "<INIT_SCRIPT_FROM_GET>" open "<ENTRY_URL_FROM_GET>"
|
|
29
|
-
agent-browser webmcp invoke <TOOL_NAME> --params '{"key": "value"}'
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Tab already open: `agent-browser eval "$(cat <INIT_SCRIPT>)"`, then
|
|
33
|
-
`agent-browser webmcp list --json`, then invoke as above.
|
|
34
|
-
|
|
35
|
-
Done when: invoke prints the tool result.
|
|
36
|
-
|
|
37
|
-
## Playwright MCP
|
|
38
|
-
|
|
39
|
-
1. `browser_navigate` to the entry URL.
|
|
40
|
-
2. `browser_evaluate` the init script bytes, then
|
|
41
|
-
`window.webmcp.TOOL(args)` in the same evaluation.
|
|
42
|
-
|
|
43
|
-
Done when: the evaluation returns the tool result.
|