diff --git a/README.md b/README.md index 3c92da8..c085271 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,10 @@ Agents with built-in WebMCP browser support, such as Codex, discover and call to The extension will be deprecated when Chrome provides native bridging to desktop clients. +### Testing in Chrome + +Google's [WebMCP extension](https://github.com/GoogleChromeLabs/webmcp-extension) lists a page's tools and runs an agent against them from a side panel, which is handy while building tools. It only sees tools registered through Chrome's native API, so on a page running the polyfill it finds nothing. Turn on `chrome://flags/#enable-webmcp-testing` (the extension needs Chrome 155 or newer) and `` will use the native API instead of the polyfill. + ## Usage ### Execution state @@ -188,6 +192,8 @@ useMcpTool({ }); ``` +`onError` fires when the handler throws. A handler that returns `{ isError: true }` on its own still counts as a success, so `onSuccess` fires for it. + ### JSON Schema Pass `inputSchema` directly to define a tool without Zod: diff --git a/docs/api.md b/docs/api.md index 4d77163..4b2dd55 100644 --- a/docs/api.md +++ b/docs/api.md @@ -68,6 +68,8 @@ These are the only annotation fields supported. The classic MCP hints (`destruct `exposedTo?: string[]` lets you control cross-frame origin visibility. Each entry must be a parseable, potentially-trustworthy origin (e.g. `https://example.com`). Changing `exposedTo` re-registers the tool. Invalid origins cause registration to reject (see below). +WebMCP is gated by the `tools` Permissions Policy feature, which defaults to `'self'`. A cross-origin iframe can't use `document.modelContext` at all unless the embedding page delegates it with `