A WebMCP Tool Is Registered but Failing: Debug the Contract in Chrome
The agent finds the right tool. Chrome shows a registration. The application still returns INVALID_ARGUMENTS. That failure is easy to misdiagnose as a model problem. In the companion fixture, it has a simpler cause: the
The agent finds the right tool. Chrome shows a registration. The application still returns INVALID_ARGUMENTS.
That failure is easy to misdiagnose as a model problem. In the companion fixture, it has a simpler cause: the tool advertises an argument called id, while the callback expects eventId. The agent can follow the advertised schema perfectly and still fail.
This article uses that deliberately broken contract to connect Chrome's WebMCP panel, the Chrome DevTools MCP server, and a small TypeScript validation test. The goal is to locate the broken boundary before changing prompts or adding retries.
Build a failure that has one explanation
The fixture contains a single synthetic event and one tool, read_event_summary. Its callback accepts exactly one known event identifier. It rejects extra properties and unknown resources.
The broken and corrected schemas differ in one field:
// Broken advertisement
properties: { id: { type: "string" } }
required: ["id"]
// Correct advertisement
properties: { eventId: { type: "string" } }
required: ["eventId"]
These are excerpts from the two complete schema objects in tool.ts. Open the browser fixture with ?broken to expose the first version. Remove that parameter to expose the corrected version.
Before involving an agent, the companion test calls the callback with each argument shape. The advertised id fails; the corrected eventId reads the intended fixture. A third test rejects an unknown resource and extra arguments. All three tests passed locally.
That establishes the application bug independently of any model's tool selection. It does not establish how a particular agent behaves in Chrome.
Read the browser's evidence in order
Chrome documents a WebMCP panel in DevTools. Use it to answer concrete questions: which tools are registered, what schema does the page expose, and what happened when a call executed?
Start with discovery. If the tool is missing, investigate registration timing, component lifetime, document context, and feature configuration. An execution error is irrelevant until the expected registration exists.
Then compare the actual arguments with the callback's validator. A valid JSON object can still violate the application contract. Finally inspect the result and the user-visible state separately. A successful read callback should return the correct event, while a mutation would need an additional check that the intended state changed.
An invocation count has a limited meaning. Zero invocations tells you that the tool was not called in that observation. It does not prove the model never saw or considered the tool.
Configure the agent's debugging connection explicitly
The Chrome DevTools agent guide describes using browser tooling to inspect WebMCP. The companion configuration pins chrome-devtools-mcp rather than relying on an unspecified latest version:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": [
"-y", "[email protected]",
"--isolated",
"--categoryExperimentalWebmcp",
"--chromeArg=--enable-features=WebMCP",
"--no-usage-statistics"
]
}
}
}
The category and browser feature settings do different jobs. One enables the server's WebMCP tooling; the other enables the browser feature in the launched Chrome instance. A supported Chrome installation is still required.
There is a second distinction in the current server's configuration reference. Tools exposed for developer use with debugging: true belong to the experimental third-party category. The ordinary WebMCP category excludes those debugging tools.
At the November 22, 2026 verification point, [email protected] remains the current registry version. WebMCP debugging is still experimental, so record the Chrome channel and feature configuration with each run.
The package therefore includes a second configuration that adds --categoryExperimentalThirdParty. The page's ?developer parameter marks the fixture tool for debugging, making this difference reproducible. If a tool is visible in one view and absent from another, inspect those settings before rewriting its registration.
Give the debugging agent a bounded task
A useful instruction is concrete enough to check:
Inspect the registered schema for
read_event_summary. Call it using the advertised argument. Compare the result with the callback's expected input and identify the smallest contract correction.
Do not ask the agent to βfix all WebMCP problemsβ in a profile containing unrelated application tabs. Use the isolated profile and local fixture, then inspect the proposed code change. The example requires no provider key for its application code; the agent client may have its own model configuration.
The expected correction is small: change the advertised field and required list to eventId. The application validator stays in place. Removing validation would hide the mismatch and weaken the contract for every caller.
Keep hints separate from enforcement
The fixture marks the tool as read-only. That is useful metadata for clients, but the callback's behavior is what makes the operation read-only. A hint does not authorize a caller, validate arguments, or constrain arbitrary implementation code.
This matters more when moving the pattern into Trip Workbench. An event identifier should be checked against the current application context and server authorization. A debugging tool that happens to receive a valid identifier should not acquire broader access merely because the schema accepts a string.
Keep the example intentionally small: one fixture, one input shape, one result. Once that contract is correct, add resource authorization and state-effect checks at the appropriate application boundaries.
Capture a useful debugging record
The package includes browser steps and a result template for registration, submitted arguments, callback output, and the observed correction. Native DevTools execution has not yet been run for this companion, so no screenshot or transcript is presented as a successful browser session.
When you run it, capture the failing and corrected schemas from the same Chrome version. Include the command-line configuration and whether the tool had debugging: true. That evidence lets another developer distinguish a schema bug from a discovery-category problem.
The larger lesson is practical: make the advertised contract, runtime validator, and observed effect agree before tuning the agent. DevTools becomes much more useful when every inspection step answers one specific question.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.