api-platform / api-platform/core

[MCP] MCP Inspector warns about incompatible JSON Schemas / Change type hinting for nullable type

Open
#8,504 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.6k
Forks
980
Avg merge
2d 5h
Merged PRs (30d)
48

Description

Since recently MCP Inspector warns about the produced schema type hints:

```
`type` is an array (["string","null"]). The array form is legal JSON Schema, but several MCP clients read `type` as a single string and either reject the tool or drop the constraint.

Fix: Split it into `anyOf` branches, each with a single `type` — `{"anyOf": [{"type": "string"}, {"type": "null"}]}`. (Making the property optional instead is a different contract: absent is not the same as `null`.)
```

Like the warning message says, the behavior of the API Platform here is not necessarily wrong, but changing the way how these type hints are declared might ensure wider compatibility.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.