WebMCP integration reference
ViewCue integrates with the page-side WebMCP surface exposed as document.modelContext.
Host-owned tools
The host application registers domain tools:
ts
await document.modelContext.registerTool({
name: "prepare_payment",
title: "Prepare a payment method",
description: "Prepare a synthetic payment method preview.",
inputSchema: {
type: "object",
properties: {
method: { type: "string", enum: ["qris", "bank_transfer", "deposit"] },
},
required: ["method"],
additionalProperties: false,
},
execute: async ({ method }) => {
// Host application owns this behavior.
choosePaymentMethod(method)
return JSON.stringify({ ok: true, method, simulation: true })
},
})ViewCue helper tools
When WebMCP is supported, the standalone bundle can register:
| Tool | Purpose |
|---|---|
get_visible_ui_context | Read bounded visible targets and current clue context |
show_ui_clue | Show a clue at a registered target |
clear_ui_guidance | Remove the current clue |
These are presentation helpers. They do not replace the host application’s domain tools.
Registration behavior
The integration feature-detects document.modelContext.registerTool(). If WebMCP is unavailable, the visual runtime still works for host UI calls.
The current experimental WebMCP API is page-scoped. The agent must be connected to the open page to discover and invoke its tools.