What this thread does
Do first: Upgrade MCP PHP SDK to v0.10.0 and follow that release’s namespace migration notes.
Symptom
m-vo reported nested empty objects being rejected as arrays by SchemaValidator; the reproduction annotates the result as `Invalid type. Expected object, but received array.. The original example decodes {"parameters":{}}` into associative arrays before validation. Other users commented on the issue, including jarrettdustinqq and codekandis.
Cause
Associative decoding maps both an empty JSON object and an empty JSON array to the same PHP value. A schema cannot reconstruct that lost distinction reliably. The merged change preserves JSON types at the tool-call parsing boundary rather than recursively guessing types from a schema.
Fix
1. Upgrade MCP PHP SDK to v0.10.0 and follow that release’s namespace migration notes. Source. 2. For handlers that need to distinguish objects from arrays, use \stdClass or object parameters. The release documentation also describes mixed and untyped parameters retaining object values. Source. 3. Keep array parameters only when recursive conversion to arrays is intended. The validation fix does not make an array parameter preserve object identity. Source.
The v0.10.0 release documentation still distinguishes array-typed handlers from object-preserving handlers and describes validation before parameter casting. The supplied compare evidence reports the fix merge as behind the release tag.
Fixed in
First stable fix: v0.10.0 (released 2026-11-10). PR #678 merged on 2026-11-08.
If it still fails
- This fixes the SDK tool-call ingress path. An application that has already collapsed JSON objects and arrays before calling a validator has lost the distinction. Top-level tool
argumentsmust be a JSON object: the PR states thatnulland[]are rejected with-32600.
Not for: MCP PHP SDK schema mismatches for a real JSON array where an object is required.
Sources
- SchemaValidator rejects nested empty JSON objects as arrays, m-vo, opened 2026-10-10; closed as completed on 2026-11-08: "Nested empty objects in tool arguments are rejected as arrays."
- Issue comment, jarrettdustinqq, 2026-10-10; parent issue closed as completed on 2026-11-08.
- Issue comment, codekandis, 2026-10-11; parent issue closed as completed on 2026-11-08.
- [[Server] Keep JSON types of tool call arguments](https://github.com/modelcontextprotocol/php-sdk/pull/678), chr-hertel; merged 2026-11-08 (closed).
- v0.10.0, published 2026-11-10.
- Release-tag source or documentation, read 2026-11-24.
- Release containment comparison, read 2026-11-24; merge commit is behind the release tag.
Checked
2026-11-24; read the issue and linked comments, merged PR and release records, plus the release-tag source/documentation linked above and the release containment compare record; no command was run.
Started from a post by @m-vo, packaged by the editor. Original post