A React demo exposes a tool, an inspector discovers it, and a call returns the expected event title. That is a useful milestone. It does not tell you which implementation made the result possible.

This distinction matters when a fallback quietly installs itself before the application starts. A successful demo can then become a misleading browser compatibility claim. For a project such as Trip Workbench, where the same workflow is useful to humans and agents, I want the application to keep working while the evidence remains specific.

The companion example separates native WebMCP from the W3C OSS polyfill at bootstrap. Its purpose is to compare one small application contract without pretending the implementations are interchangeable.

Start with two explicit execution paths

The current WebMCP draft is still evolving. The polyfill provides an implementation of selected browser-facing capabilities; it does not turn every browser into a native WebMCP browser.

The first design decision is therefore outside React. Select an execution path before rendering components or registering tools:

const contextBeforeSetup = document.modelContext; if (lane === "polyfill") { installPolyfill(); } const context = document.modelContext; if (!context?.registerTool || !context.getTools || !context.executeTool) { throw new Error("Required WebMCP methods are unavailable"); } 

This is an abbreviated view of bootstrap.ts. The native path never installs a fallback. If it cannot provide the methods the example needs, it fails visibly.

The polyfill path records whether a context existed before installation. That detail prevents another overclaim: an existing context is not automatically native. An extension, test harness, or earlier application script might have created it. The fixture reports provenance as “pre-existing” or “installed by this fixture,” leaving browser identity to the run record.

Define the comparison before running it

Use one read-only event summary tool with fixed synthetic data. Keep its name, input schema, callback, and expected output identical in both paths. Avoid comparing a native declarative form against an imperative polyfill tool and calling the result an implementation comparison.

The useful questions are narrow:

Question How to establish it
Did the expected tool register? Inspect discovery after mounting
Does a valid call return the fixture? Execute the same arguments
Does invalid input fail safely? Exercise application validation
Does unmounting remove the registration? Inspect discovery after cleanup
Which implementation supplied the context? Record setup order and browser configuration

A green result on this table says something meaningful about the tested application. It says little about untested platform features, cross-frame behavior, or browser permission enforcement.

Two explicit bootstrap paths preserve implementation provenance before sharing the same React tool contract.

Keep lifecycle behavior in the experiment

The browser fixture mounts a React component that exposes read_event_summary. A button removes that component. This creates a simple lifecycle test: the tool should exist while its owner is mounted and disappear when that owner leaves.

React's effect documentation makes cleanup part of the contract. Development Strict Mode also exercises setup and cleanup more than a simple production mount. That is a useful way to find registration leaks, provided the test records which build it ran.

Do not “fix” duplicate tools by removing Strict Mode from the experiment. First check whether registration has a matching cleanup operation and whether the component uses a stable tool identity. The companion uses the pinned React hook package for this lifecycle and keeps the bootstrap choice outside that component.

The unit tests focus on the bootstrap guarantees: the native path cannot call the installer, explicit installation has recorded provenance, a partial context is rejected, and a missing native context does not silently change the experiment. These tests passed locally. They are not native-browser conformance tests.

Compare documented limitations separately

The polyfill's own testing notes are a better starting point than a generic “works everywhere” label. They distinguish supported behavior from platform features JavaScript cannot fully reproduce.

Three boundaries affect application design. Declarative forms are a separate capability; do not infer them from successful imperative registration. Script-created events cannot acquire the browser's trusted-event status. Permission behavior also has limitations when the implementation cannot inspect or enforce native policy information.

The installer preserves an existing context, including a partial one. Installing it again is therefore not a general repair strategy. If a method your application requires is absent, report the missing capability and keep the human workflow usable.

These are documented differences, not performance measurements from this example. A useful comparison keeps those categories separate rather than presenting a single percentage called “compatibility.”

Reproduce the small test first

The package pins its dependencies and includes a lockfile. From its code directory:

npm ci npm run typecheck npm test npm run build npm run serve 

Open the fixture with the requested execution path in a dedicated browser profile. Record the browser version, operating system, WebMCP feature configuration, initial context presence, and tool discovery before and after unmounting. Run the native path without loading the fallback. Run the fallback path in an environment where the fixture can actually install it; otherwise record that the existing implementation was preserved.

Native browser execution remains a separate step in this package. The included result sheet intentionally leaves those observations unfilled until a compatible browser run is completed. That is preferable to promoting unit-test results into browser evidence.

Use the fallback to support a product decision

The comparison becomes useful when it answers a specific deployment question. Perhaps the application needs imperative read tools today and can keep ordinary form submission for users. Perhaps it depends on native declarative behavior and should show a capability-specific enhancement only in eligible browsers.

Either decision is stronger than treating one global property as proof of complete support. Keep capability checks close to the features that need them, record the implementation used in reproducible runs, and let the existing UI remain the dependable path through the application.

A small, honest comparison is easier to maintain as WebMCP changes. More importantly, readers can rerun it and understand exactly what a passing result establishes.