# MCP tool input schema validation, tested from the schema

> MCP tool input schema validation, from our own bug: a proxy tool offered a label field, then refused it with a 400. The check that caught it reads the schema.

Source: https://mosaicbrowser.com/blog/mcp-schema-lies

## A tool schema that advertised a field its validator refused

MCP tool input schema validation, from our own bug: a proxy tool offered a label field, then refused it with a 400. The check that caught it reads the schema.

![A schema that offered a field it refused, beside a screenshot: the Mosaic MCP server: let an AI assistant manage profiles, proxies and launches](https://mosaicbrowser.com/covers/mcp-schema-lies.webp)

MCP tool input schema validation has two halves: the schema a model reads, and whatever checks the call behind it. The schema is the only description of the tool a model ever sees, so the two have to agree. Ours did not. `update_proxy` advertised a field called `label`, and the validator behind it refused `label` by name with a `400`. A model doing exactly what the tool told it to do got an error for doing it. We found it with a check that takes its field names from `inputSchema.properties`, and only on the check's second version.

## How the call failed

A saved proxy in Mosaic has a `name`. The REST route that edits one runs the body through `proxyBody`, which refuses any key it does not know, because a misspelt field and a stored one look the same from outside. Its message is the usual one:

```
Unknown proxy field `label`. Valid fields are: city, countryCode, host, name, ...

```

That is the right refusal for a person who typed `label` by mistake. It is the wrong one for a caller who read `label` in the tool's own schema. There was no way for that caller to be right: the schema said send `label`, the validator said `label` does not exist, and the model has nobody to ask which one meant it.

We count this as worse than a silent no-op. A caller who hits a no-op could, in principle, have sent something else; a caller who hits this has no correct move at all. It also hides well, because a `400` for following the documentation looks like the model's mistake, and anyone reading the transcript blames the model.

Mosaic is a desktop app

Email yourself the link and open it on your computer.

[How it works: MCP server](https://mosaicbrowser.com/features/mcp-server)

## MCP tool input schema validation, starting from none

The `label` bug sat on top of an older one. Mosaic's MCP server first shipped with no argument checking. Every tool declared an `inputSchema`, the schema went to the model in `tools/list`, and then `tools/call` passed the arguments to the handler without looking at them again.

On 17 September 2026 we measured what that meant. `get_project` takes `id`. Called with `{ "projectId": "…" }`, it answered `No project with id undefined`. The misspelt key was dropped, the handler ran on nothing, and the caller was told the project did not exist.

Since then one gate, `src/main/api/mcp-args.ts`, runs before every handler, with the same rules as the REST validator:

- An unknown argument is refused, and the message lists the ones that exist: ``projectId` is not an argument of get_project. It takes: id.`
- A missing required argument is refused by name before the handler sees `undefined`.
- A wrong type is refused rather than coerced. `"3"` is not quietly turned into `3`, because then the stored type would depend on who called.
- `null` on an optional field counts as absent, because models fill every field of a schema and write `null` for the ones they do not want.

Only the top level is checked there. A nested object such as `run_warmup`'s `options` goes on to the handler, which validates its own shape. Writing those rules a second time in the gate would give one fact two descriptions, and the second copy is the one that drifts.

![Settings › MCP in Mosaic: the server switch, port 39218 and the stdio client config](https://mosaicbrowser.com/shots/settings-mcp.png)
*Settings › MCP: the server is off until you turn it on*

## Why the gate did not catch label

The gate checks a call against the schema. If the schema itself is wrong, a call that matches it passes the gate and then hits the REST validator underneath, which has its own list. Two lists of field names for one object, and they disagreed.

Our first check for this sent each tool a hand-written set of field names and asserted that none came back as unknown. It passed. Of course it passed: we had written the names from the proxy object, so we had tested the validator against itself, and never once read what the schema offered.

The second version takes the names from the thing under test. For every tool, `check:mcp-reach` walks `inputSchema.properties`, builds a plausible value per declared type (a string `x`, the number 1, the first enum value), calls the handler with that one field, and fails only on a refusal shaped like `Unknown … field`. A value the field legitimately rejects, such as a two-letter country code that is not `x`, is the check's sample being wrong and is allowed. The schema and the validator disagreeing is the fault. On its first run it found `update_proxy`.

The fix was one word in the schema. The comment above that line in `mcp.ts` now says why it is `name` and not `label`, and the check holds it.

## What carries over to any MCP server

1. Validate every call against the schema you published, before the handler runs, and name the field in the refusal.
2. If a lower layer has its own list of fields, test the schema against that layer, with names read from the schema.
3. Treat `null` as absent on optional fields, because that is what models send.
4. Put the arguments the tool does take into the error. A model fixes a misspelling in one retry when the right word is in front of it.

How the rest of Mosaic's MCP server behaves with a model as the caller, including the list tools that once returned every row, is in [letting an AI assistant run browser profiles](https://mosaicbrowser.com/blog/ai-assistant-runs-profiles). The same rules from the protocol's side are on [Model Context Protocol](https://mosaicbrowser.com/glossary/model-context-protocol), and a worked set-up with a client is in [the MCP server guide](https://mosaicbrowser.com/guides/mcp-server-for-browser-automation). The server ships with Pro; what it can reach is on [the MCP server page](https://mosaicbrowser.com/features/mcp-server).

## Questions

### Does an MCP server validate tool arguments against the input schema?

Only if it is written to. Mosaic's first MCP server handed every schema to the model and then passed the arguments to the handler without checking them. Now one gate, mcp-args.ts, checks every call before any handler runs.

### What does Mosaic do with an argument the tool does not take?

It refuses the call and names the field, then lists the arguments the tool does take, for example: projectId is not an argument of get_project. It takes: id.

### How do you test that a tool's schema matches its validator?

Take the field names from the tool's own inputSchema.properties, send each one with a plausible value, and fail on any unknown-field refusal. A hand-written list of names tests the validator and never reads the schema.

### Is null an error in a Mosaic MCP call?

No. A model that fills every field and writes null for the ones it does not want is doing the normal thing, so null on an optional field is treated as absent.

## Related

[An anti-detect browser MCP server for your AI assistant](https://mosaicbrowser.com/features/mcp-server): Mosaic's anti-detect browser MCP server lets Claude or any MCP client create, launch and drive your profiles. 150+ tools, off by default, key-gated.

[Letting an AI assistant run browser profiles over MCP](https://mosaicbrowser.com/blog/ai-assistant-runs-profiles): Mosaic's MCP server lets Claude or any MCP client create, start and drive browser profiles. Three faults we found when a model was the caller.

[MCP server for browser automation: what it is and which to use](https://mosaicbrowser.com/guides/mcp-server-for-browser-automation): An MCP server for browser automation turns page actions into tools an AI assistant can call. Playwright MCP, Chrome DevTools MCP and Mosaic compared.

[Model Context Protocol (MCP): how an AI assistant calls tools](https://mosaicbrowser.com/glossary/model-context-protocol): The Model Context Protocol is an open standard, published by Anthropic in November 2024, for connecting AI apps to tools and data through MCP servers.

[Anti-detect browser REST API: profiles from your scripts](https://mosaicbrowser.com/features/rest-api): Mosaic's anti-detect browser REST API runs on 127.0.0.1 with API keys. Create and start profiles, then attach Puppeteer or Playwright over CDP.







[Why our MCP server speaks HTTP and still ships a stdio bridge](https://mosaicbrowser.com/blog/mcp-streamable-http-and-stdio): stdio means the client starts the server. Mosaic is already running, so its MCP server is HTTP inside the app, plus a small stdio bridge for clients.

## Mosaic, on your own computer

The browser this blog is about: its own Chromium, fingerprints from real machines and a proxy IP per profile. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

Mosaic is a desktop app

Email yourself the link and open it on your computer.
