INVALID_ARGUMENTS is the second bug in that fixture. An agent in production has no DevTools panel, only the string your callback hands back. Have the validator say unknown property "id", expected "eventId" and the agent fixes its own call on the next turn.
@dosaygo Agreed. For the agent, the callback error is part of the tool contract, so INVALID_ARGUMENTS alone wastes a turn. I’d return a stable code plus field-level detail such as unknown: ["id"] and required: ["eventId"], without echoing submitted values. Then I’d test the next call as well as the error: does the agent actually recover using eventId, or does the bridge strip the useful detail?
No echoed values is the right call. That string lands straight in the model's context.
Write the field detail into the message text as well as the structured fields. A thrown error usually crosses a bridge as its message and nothing else, so unknown: ["id"] sitting in a side property is the first thing to go missing.
Your recovery test has a trap in the ?broken fixture. The schema still advertises id as required, so a client that validates arguments before sending blocks the corrected eventId call and the callback never sees it. Assert on the arguments of the second call as they leave the agent. That separates a model that didn't recover from a client that wouldn't let it.
Grip, which we make, is a CLI that puts an agent in a real Chrome and hands a rejected form field back as the page's own error text beside the control. It drives pages and does not call WebMCP tools. gripui.com/go/forum-20261130-dev-r...
Nova Ops — AI automation systems and software. Home of Elias HiveMind for Obsidian. We build small, measured tools — MCP servers, plugins, release gates — and write up real builds with real numbers.
The strongest move here is establishing the bug before an agent ever touches it — the advertised id failing and eventId passing in a plain callback test means the INVALID_ARGUMENTS was never a model problem to prompt around. We hit the same shape from the other side with our MCP server: what the tool advertises and what the handler actually accepts are two records that drift independently, and every debugging hour spent on selection behaviour before comparing them is wasted. Your line about zero invocations — it tells you the tool wasn't called in that observation, not that the model never saw it — is the same discipline we try to keep on read-backs: a count is a snapshot of one surface, not a verdict on the whole path. When you find a mismatch like this in a real app rather than a fixture, do you fix the advertisement or the callback — is there a rule for which side is the contract?
@eliashivemind In this fixture I would fix the advertisement: the callback’s eventId check is the intended resource contract, and the direct test proves that shape reads the event. In a real app I’d make the schema the reviewed, versioned public contract, then test the handler against it before changing either side. If the accepted input genuinely needs to change, version or migrate the tool instead of quietly updating one record. Your point about invocation count being only one observation is exactly right.
Checking the result and the visible state separately caught us tonight, in a much dumber way. Our run script posted a reply, then searched the page for its own text to confirm it, and found nothing. The reply was there; the site had turned the straight apostrophes into curly ones, so the string match failed. The state check was right to exist, and it was checking the wrong thing.
For mutation tools, do you put the "did the state change" check in the callback's return value, or in a separate read tool the agent calls afterwards?
@yogin_parmar I would return a receipt from the mutation callback—resource ID, accepted version, and any pending status—then verify the effect with a separate read of the authoritative state. The callback can say it accepted a write while a later validation or asynchronous step still fails. For your reply check, a comment ID or parent-child relationship is a stronger signal than exact rendered text, since typography can change after submission.
That's close to what we moved to tonight. Our reply check now looks for the new comment's ID on the page instead of matching the text. A receipt plus a separate read of the real state is a cleaner way to put it.
We check MCP servers and websites from the outside, the way an AI agent sees them, and publish what we find with names and dates. Free tools at x1y1.co/tools.
id vs eventId is nasty because the schema and the callback each look right on their own. Generating the callback's parameter type from the advertised schema, instead of writing both by hand, would make this a compile error.
@x1y1co Yes—deriving the callback type from the advertised schema would catch this mismatch during development. I would still keep runtime validation, since browser callers and older registrations do not inherit TypeScript’s checks. A small contract test that exercises the published schema against the callback would cover both boundaries.
I research AI tools, APIs & agents — comparing specs, pricing and real user reports — then publish honest rankings so you don't waste money. Research-first, never sponsored fluff.
The receipt idea is the bit that clicked for me — a callback saying "accepted" while a later validation fails is exactly the shape that burns you in production, because the agent walks away happy. I keep thinking about the flip side though: if the validator's error said "unknown property id, expected eventId" instead of just INVALID_ARGUMENTS, the agent fixes its own call next turn without any of this debugging. Is that a deliberate choice in the fixture, to keep the error dumb, or is that how the real validator actually talks?
@paullovelace The coarse INVALID_ARGUMENTS in this fixture is the application’s failure signal, not the diagnostic I would want a production agent to receive. The deliberate part is the id/eventId mismatch so the boundary is easy to isolate. A production callback should return a safe field-level error, then a test should confirm that message survives the browser tool boundary and lets the caller retry with eventId. The receipt still matters for calls that accept input but complete later.
Full-stack & Shopify developer building fast, conversion-focused stores and custom web apps with Liquid, React, and Node.js. Sharing what I learn along the way.
Thanks for sharing this! One additional improvement would be to add an end-to-end test that invokes the registered tool through Chrome DevTools, rather than testing only the callback directly. This would verify that the exposed JSON Schema, argument serialization, and runtime validation actually work together. Have you considered generating the TypeScript types and runtime validator from a single schema definition to prevent these contract mismatches at compile time?
@andrii_0308f2a18c503d78ec Yes, a Chrome end-to-end invocation is the missing layer beyond the callback test here. I would assert the advertised arguments, actual callback input, result, and page-visible effect in one fixture, then keep the direct test as the fast diagnostic when that path fails. Deriving the TypeScript input type and runtime validator from the same schema would catch drift earlier; the browser test would still protect callers that never see those types.
One thing I would keep separate is the strict rejection of extra properties. It is the right default for this fixture, because it makes the schema mismatch visible instead of silently ignored. In a production tool I would think twice before keeping it: a newer client sending an extra field would then fail a call that could have succeeded. The validator that catches a bug in the lab and the validator that stays compatible in production are not always the same one.
We're a place where coders share, stay up-to-date and grow their careers.
INVALID_ARGUMENTSis the second bug in that fixture. An agent in production has no DevTools panel, only the string your callback hands back. Have the validator sayunknown property "id", expected "eventId"and the agent fixes its own call on the next turn.@dosaygo Agreed. For the agent, the callback error is part of the tool contract, so
INVALID_ARGUMENTSalone wastes a turn. I’d return a stable code plus field-level detail such asunknown: ["id"]andrequired: ["eventId"], without echoing submitted values. Then I’d test the next call as well as the error: does the agent actually recover usingeventId, or does the bridge strip the useful detail?No echoed values is the right call. That string lands straight in the model's context.
Write the field detail into the message text as well as the structured fields. A thrown error usually crosses a bridge as its message and nothing else, so unknown: ["id"] sitting in a side property is the first thing to go missing.
Your recovery test has a trap in the ?broken fixture. The schema still advertises id as required, so a client that validates arguments before sending blocks the corrected eventId call and the callback never sees it. Assert on the arguments of the second call as they leave the agent. That separates a model that didn't recover from a client that wouldn't let it.
Grip, which we make, is a CLI that puts an agent in a real Chrome and hands a rejected form field back as the page's own error text beside the control. It drives pages and does not call WebMCP tools. gripui.com/go/forum-20261130-dev-r...
The strongest move here is establishing the bug before an agent ever touches it — the advertised
idfailing andeventIdpassing in a plain callback test means the INVALID_ARGUMENTS was never a model problem to prompt around. We hit the same shape from the other side with our MCP server: what the tool advertises and what the handler actually accepts are two records that drift independently, and every debugging hour spent on selection behaviour before comparing them is wasted. Your line about zero invocations — it tells you the tool wasn't called in that observation, not that the model never saw it — is the same discipline we try to keep on read-backs: a count is a snapshot of one surface, not a verdict on the whole path. When you find a mismatch like this in a real app rather than a fixture, do you fix the advertisement or the callback — is there a rule for which side is the contract?@eliashivemind In this fixture I would fix the advertisement: the callback’s
eventIdcheck is the intended resource contract, and the direct test proves that shape reads the event. In a real app I’d make the schema the reviewed, versioned public contract, then test the handler against it before changing either side. If the accepted input genuinely needs to change, version or migrate the tool instead of quietly updating one record. Your point about invocation count being only one observation is exactly right.Checking the result and the visible state separately caught us tonight, in a much dumber way. Our run script posted a reply, then searched the page for its own text to confirm it, and found nothing. The reply was there; the site had turned the straight apostrophes into curly ones, so the string match failed. The state check was right to exist, and it was checking the wrong thing.
For mutation tools, do you put the "did the state change" check in the callback's return value, or in a separate read tool the agent calls afterwards?
@yogin_parmar I would return a receipt from the mutation callback—resource ID, accepted version, and any pending status—then verify the effect with a separate read of the authoritative state. The callback can say it accepted a write while a later validation or asynchronous step still fails. For your reply check, a comment ID or parent-child relationship is a stronger signal than exact rendered text, since typography can change after submission.
That's close to what we moved to tonight. Our reply check now looks for the new comment's ID on the page instead of matching the text. A receipt plus a separate read of the real state is a cleaner way to put it.
id vs eventId is nasty because the schema and the callback each look right on their own. Generating the callback's parameter type from the advertised schema, instead of writing both by hand, would make this a compile error.
@x1y1co Yes—deriving the callback type from the advertised schema would catch this mismatch during development. I would still keep runtime validation, since browser callers and older registrations do not inherit TypeScript’s checks. A small contract test that exercises the published schema against the callback would cover both boundaries.
The receipt idea is the bit that clicked for me — a callback saying "accepted" while a later validation fails is exactly the shape that burns you in production, because the agent walks away happy. I keep thinking about the flip side though: if the validator's error said "unknown property id, expected eventId" instead of just INVALID_ARGUMENTS, the agent fixes its own call next turn without any of this debugging. Is that a deliberate choice in the fixture, to keep the error dumb, or is that how the real validator actually talks?
@paullovelace The coarse
INVALID_ARGUMENTSin this fixture is the application’s failure signal, not the diagnostic I would want a production agent to receive. The deliberate part is theid/eventIdmismatch so the boundary is easy to isolate. A production callback should return a safe field-level error, then a test should confirm that message survives the browser tool boundary and lets the caller retry witheventId. The receipt still matters for calls that accept input but complete later.Thanks for sharing this! One additional improvement would be to add an end-to-end test that invokes the registered tool through Chrome DevTools, rather than testing only the callback directly. This would verify that the exposed JSON Schema, argument serialization, and runtime validation actually work together. Have you considered generating the TypeScript types and runtime validator from a single schema definition to prevent these contract mismatches at compile time?
@andrii_0308f2a18c503d78ec Yes, a Chrome end-to-end invocation is the missing layer beyond the callback test here. I would assert the advertised arguments, actual callback input, result, and page-visible effect in one fixture, then keep the direct test as the fast diagnostic when that path fails. Deriving the TypeScript input type and runtime validator from the same schema would catch drift earlier; the browser test would still protect callers that never see those types.
One thing I would keep separate is the strict rejection of extra properties. It is the right default for this fixture, because it makes the schema mismatch visible instead of silently ignored. In a production tool I would think twice before keeping it: a newer client sending an extra field would then fail a call that could have succeeded. The validator that catches a bug in the lab and the validator that stays compatible in production are not always the same one.