Context
Chrome origin-trial implementation (chrome://flags/#enable-webmcp-testing, document.modelContext, 149+) and the CG draft diverge on I/O shapes. This causes the same tool registration to be green in a headless stub and red in flagged Chrome (and vice versa).
Observed in Chrome native vs a postMessage test stub that follows the draft IDL literally:
| Surface |
getTools() RegisteredTool.inputSchema |
executeTool arg |
executeTool result |
Draft (index.bs / webmcp.d.ts literal) |
object (JSON Schema) |
object via tool.execute(object) |
object |
Chrome native (document.modelContext.getTools() / executeTool(tool, inputJson:string)) — see implementation-status.md |
string (stringified JSON Schema) — TueJon/webmcpify skills/webmcpify/templates/webmcp.d.ts:97, skills/webmcpify/templates/webmcp.spec.ts:67 JSON.parse(tool.inputSchema) |
string (JSON.stringify(args)) — webmcp.spec.ts:95 mc.executeTool(tool, JSON.stringify(args)) |
string ("{\"ok\":true,…}") or null on navigation |
Specifics:
RegisteredTool.inputSchema is string on native (TueJon/webmcpify templates/webmcp.d.ts:97 comment: "NOTE inputSchema is a STRINGIFIED JSON Schema") but object in the draft IDL.
executeTool(RegisteredTool, inputJson:string) (Chrome-only, not yet in draft per webmcp.d.ts:62) takes a JSON string; the draft-era stub exposes tool.execute(object). Mismatch throws UnknownError: Failed to parse input arguments one way, type error the other.
- Result is
string | null on native (webmcp.d.ts:65 + webmcp.spec.ts:83), object on stub.
Request
Norm one of:
- Keep draft
object and note Chrome's stringified wire format as impl detail with a recommended typeof === 'string' ? JSON.parse : id + JSON.stringify before executeTool compat shim, or
- Norm the stringified form (
inputSchema: string, executeTool(tool, string), result string|null) and update index.bs accordingly.
Either way, explicit guidance that consumers should handle both shapes (parse inputSchema if string, accept result as string or object, stringify args for native with fallback) would prevent every kit (e.g. TueJon/webmcpify) from rediscovering this independently.
Happy to PR the explainer note once direction is set.
Context
Chrome origin-trial implementation (
chrome://flags/#enable-webmcp-testing,document.modelContext, 149+) and the CG draft diverge on I/O shapes. This causes the same tool registration to be green in a headless stub and red in flagged Chrome (and vice versa).Observed in Chrome native vs a
postMessagetest stub that follows the draft IDL literally:getTools()RegisteredTool.inputSchemaexecuteToolargexecuteToolresultindex.bs/webmcp.d.tsliteral)object(JSON Schema)objectviatool.execute(object)objectdocument.modelContext.getTools()/executeTool(tool, inputJson:string)) — seeimplementation-status.mdstring(stringified JSON Schema) —TueJon/webmcpifyskills/webmcpify/templates/webmcp.d.ts:97,skills/webmcpify/templates/webmcp.spec.ts:67JSON.parse(tool.inputSchema)string(JSON.stringify(args)) —webmcp.spec.ts:95mc.executeTool(tool, JSON.stringify(args))string("{\"ok\":true,…}") ornullon navigationSpecifics:
RegisteredTool.inputSchemaisstringon native (TueJon/webmcpifytemplates/webmcp.d.ts:97comment: "NOTE inputSchema is a STRINGIFIED JSON Schema") butobjectin the draft IDL.executeTool(RegisteredTool, inputJson:string)(Chrome-only, not yet in draft perwebmcp.d.ts:62) takes a JSON string; the draft-era stub exposestool.execute(object). Mismatch throwsUnknownError: Failed to parse input argumentsone way, type error the other.string | nullon native (webmcp.d.ts:65+webmcp.spec.ts:83),objecton stub.Request
Norm one of:
objectand note Chrome's stringified wire format as impl detail with a recommendedtypeof === 'string' ? JSON.parse : id+JSON.stringifybeforeexecuteToolcompat shim, orinputSchema: string,executeTool(tool, string), resultstring|null) and updateindex.bsaccordingly.Either way, explicit guidance that consumers should handle both shapes (parse
inputSchemaif string, acceptresultas string or object, stringify args for native with fallback) would prevent every kit (e.g.TueJon/webmcpify) from rediscovering this independently.Happy to PR the explainer note once direction is set.