document.modelContext in Chrome without installing an MCP-B runtime.
WebMCP is an experimental browser preview. The flag name and API can change between Chrome
releases. Follow Chrome’s imperative API
guide for the current native surface.
For production use, follow the polyfill path in Build your first tool.
Prerequisites
- A current Chrome channel that exposes the WebMCP testing flag
- The ability to install a Chrome extension
What we will use
- the Chrome flag that enables the preview
- the Model Context Tool Inspector recommended by Chrome’s WebMCP documentation
- the pizza-maker demo
1
Enable the WebMCP flag
- Open Chrome and navigate to
chrome://flags/#enable-webmcp-testing - Set WebMCP for testing to Enabled
- Click Relaunch
2
Install the Model Context Tool Inspector
- Open the Model Context Tool Inspector in the Chrome Web Store
- Click Add to Chrome
- Pin the extension so you can open it quickly
3
Open the demo
- Open the pizza-maker demo
- Wait for the page to finish loading
- Open DevTools and switch to the console
4
Verify the native APIs are available
Run:You should see:
Check the WebMCP surface
Expected console output
5
List the demo tools
Run:You should see tool metadata from the demo. On the pizza demo, the list includes tools such as
List registered tools
set_pizza_size, set_pizza_style, toggle_layer, and add_topping.6
Inspect the same tools in the extension
- Click the Model Context Tool Inspector while the demo tab is active
- Open its panel
- Confirm that the same tool list appears there
document.modelContext.getTools() are now showing the same native tool surface.7
Execute a tool
Run this in the console:You should see the pizza update in the page, and the console should show the tool result. Now execute the same tool from the extension panel and compare the output.
Execute add_topping
What you learned
- Chrome can expose
document.modelContextlocally behind thechrome://flags/#enable-webmcp-testingflag document.modelContext.getTools()discovers tools, and Chrome’s feature-detectedexecuteTool()extension executes a discovered tool- Chrome’s WebMCP documentation recommends the Model Context Tool Inspector for inspecting native tools
- The GoogleChromeLabs demos provide a convenient view of current native behavior
Next steps
- Build your first tool to take the portable polyfill path
- Test native and polyfill runtimes for repeatable browser test setup
- What is WebMCP? for the standard-level picture
