api-platform / api-platform/core

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

Aberta
#8,504 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
PHP
Estrelas
2.6k
Forks
980
Merge médio
2d 5h
PRs com merge (30d)
48

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.