MCP Python servers convert yes to True and 1999.0 to 1999 by default. Measured on mcp 1.30.0 and 2.3.0, with strict fields and schema-first validation.
The schema says integer; the function gets one anyway
A tool definition for a model publishes a JSON Schema for its arguments. When a model calls the tool with "amount_cents": "1999", a string where the schema asks for an integer, there are two reasonable outcomes. The server can reject the call and let the model try again, or it can convert the string to 1999 and run the tool. Most teams assume the first, because the schema says integer. Many Python servers do the second, because they validate arguments with a Pydantic model in its default lax mode, which converts compatible types instead of rejecting them.
Conversion is often harmless. It becomes a problem when it accepts values that nobody reviewing the tool would accept: the string yes as true, off as false, 1_999 as 1999, a float 1999.0 as an integer. It also means the server's behaviour no longer matches its own published schema, so clients, evaluation harnesses, gateways and servers written in other languages disagree about which calls are valid.
Measured: what the tool function receives
The local probe ran the same tool on the official MCP Python SDK in both maintained major versions: mcp 1.30.0 with FastMCP and mcp 2.3.0 with MCPServer, both with Pydantic 2.14.4, installed with uv's exclude-newer cut-off set to 2 December 2026. The tool issues a partial refund on a Belgavi's Book Store order and takes order_id: int, amount_cents: int, notify_customer: bool and items: list[str]. A second copy of the tool marks the three scalar parameters as strict. An in-process client called both with the arguments below; no network or model was involved. The third column checks each argument set against the input schema the server itself publishes, using a JSON Schema validator. Both SDK versions gave identical results.
| Arguments sent | Published schema | Default tool receives | Strict tool |
|---|---|---|---|
All scalars as strings: "7781", "1999", "yes" | rejects | 7781, 1999, True | validation error |
notify_customer: "no" | rejects | False | validation error |
notify_customer: "off" or "0" | rejects | False | validation error |
notify_customer: "maybe" | rejects | validation error | validation error |
amount_cents: 1999.0 | accepts | 1999 | validation error |
amount_cents: 19.99 or "19.99" | rejects | validation error | validation error |
amount_cents: " 1999 " | rejects | 1999 | validation error |
amount_cents: "1_999" | rejects | 1999 | validation error |
items: "[\"B-12\", \"B-14\"]" (JSON in a string) | rejects | the list | the list |
items: "B-12" | rejects | validation error | validation error |
Three things stand out. First, of the twelve argument sets other than a correctly typed call, the published schema rejected eleven, and the default tool ran on seven of those eleven. Second, the conversions follow Pydantic's documented lax rules: for booleans the accepted strings are 0, off, f, false, n, no, 1, on, t, true, y and yes. Third, the list arrived as a list even in the strict copy. Before validation the SDK parses string arguments that look like JSON for any parameter whose type is not str; the code comment says this works around clients that send arrays and objects as JSON text. Strict mode on the scalar fields does not turn that off.
The row with 1999.0 is a reminder that JSON Schema is not stricter everywhere. The integer type in JSON Schema accepts any number with a zero fractional part, so the published schema accepts it and only the strict Pydantic field rejects it.
Why it matters for agents
A model that is unsure tends to hedge in the format of its answer: quoting numbers, writing yes and no, or passing a JSON array as text. Lax validation turns those hedges into confident values. For a parameter such as notify_customer the cost is an unwanted email. For parameters such as dry_run, confirm or amount, a conversion the tool author never considered decides whether something irreversible happens. It also hides model quality problems: an evaluation that only checks the tool result never sees that the model sent strings, so a model change that makes it worse at typing arguments passes unnoticed until it reaches a server that is strict.
The MCP specification lists validating all tool inputs among the things servers must do. It does not say how strictly. That choice belongs to the server author, and the default you get from a framework may not be the one you would have chosen.
Make validation match the schema
There are two ways to close the gap, and they combine well.
Mark the parameters strict in the function signature. Pydantic's Strict marker, or the StrictInt and StrictBool types, keep the published schema the same while rejecting conversions.
from typing import Annotated
from pydantic import Strict
from mcp.server.mcpserver import MCPServer # mcp 2.x; FastMCP in mcp 1.x
server = MCPServer("refund-desk")
@server.tool()
def issue_refund(
order_id: Annotated[int, Strict()],
amount_cents: Annotated[int, Strict()],
notify_customer: Annotated[bool, Strict()],
items: list[str],
) -> str:
"""Refund part of an order. Amounts are whole cents."""
...Or validate the raw arguments against the published input schema before the framework sees them, for example in a gateway or a wrapper, and return the validator's message to the model. That makes the schema the contract, which is what clients and other servers read. Because JSON Schema still accepts 1999.0 for an integer, add a check that integer arguments arrive as JSON integers if that distinction matters.
Return the rejection as a tool error with a short, specific message: which argument, which type was expected and what arrived. Models usually correct a typed argument on the next turn when the message names it.
What the model sees when a call is rejected
A rejection only helps if the model can act on it. In both SDK versions a validation failure came back to the client as a tool result marked as an error, with Pydantic's message naming the argument and the problem. That is enough for most models to retry with the right type. A gateway that validates against the published schema should do the same: return the error as a tool result, not as a transport failure, so the agent loop treats it as feedback rather than as an outage.
Keep the message short and specific. A good one names the argument, the expected type and the value that arrived, for example that notify_customer expects a boolean and received the string yes. Avoid echoing large or sensitive arguments back in full. Count rejections per tool and per argument; a sudden rise after a model or prompt change is an early signal that argument quality has dropped, which lax validation would have hidden.
Failure modes after tightening
- Clients that relied on the conversion start failing. Log rejected calls for a week before enforcing, grouped by argument and value shape, and fix the clients or the prompts.
- Strict booleans with a model that writes
"true". The fix belongs in the tool description and the model's output, not in widening the validator again. - JSON text in string parameters. If a parameter is declared
str, the SDK leaves it alone; if it is a list or object, the pre-parsing still applies. Decide whether you want that and test it. - Different servers, different rules. A TypeScript server validating with the published schema and a Python server in lax mode accept different calls for the same tool definition. Keep a shared test set of argument shapes and run it against every implementation.
When lax conversion is acceptable
For read-only tools whose arguments only filter or page through data, accepting "25" for a page size is a reasonable convenience, and rejecting it costs a retry. Keep strict validation for parameters that change state, spend money, send messages or decide between a test run and a real one.
How to verify it
The companion example tool-argument-coercion runs the argument table above against both SDK versions with pinned dependencies and asserts each outcome, then runs the same calls through a schema-first wrapper and asserts that every row the published schema rejects is refused. Add the same table to your own server's tests for every state-changing tool.