api-platform / api-platform/core

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

未關閉
#8,504 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 5 小時
30 天內合併 PR
48

描述

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。