[Capability] Describe nullable parameters with `anyOf` instead of a `type` array?
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
Start in SchemaGenerator, where a nullable parameter currently produces a type array such as ["null", "string"]; find the branch that builds that array and the tests covering nullable scalars, enums, arrays and objects. The open question is a design one, so the first deliverable is a maintainer answer on whether anyOf should be default or opt-in before any patch. Done means every nullable parameter shape is covered and existing schema tests are updated alongside the new behaviour.
索引モデルが issue の本文から書いたものです。
説明
For a nullable parameter, SchemaGenerator emits a type array. With mcp/sdk 0.9.0, the ?string $company = null parameter of a tool gets:
{"type": ["null", "string"], "description": "The company of the speaker", "default": null}
MCP Inspector 2 then reports "Schema portability: 0 errors, 1 warning" and suggests {"anyOf": [{"type": "null"}, {"type": "string"}]}. That rule is a warning on purpose (schemaLint.ts, modelcontextprotocol/inspector#2286). The array form is what OpenAI recommends. It only costs portability to clients that map tool schemas onto a dialect with a single type.
What the providers document:
- OpenAI: "it is possible to emulate an optional parameter by using a union type with
null", with"type": ["string", "null"]in the examples.anyOfworks too, except at the root. - Anthropic: strict tool use supports
anyOf, and countsanyOfand type arrays the same in its limit on union types. - Gemini: the
parametersof a function declaration use "a select subset of an OpenAPI 3.0 schema object". Itstypeis a single value, withanyOf,nullableand aNULLtype. So only theanyOfform maps onto it.parametersJsonSchematakes JSON Schema instead.
Switching to anyOf would change the schema of every nullable parameter, including enums, arrays and objects, and clients that read type wouldn't find it anymore. So I'd rather ask first. Would you take a PR that emits anyOf for nullable parameters, maybe as an option of SchemaGenerator?
Found with the submit_proposal tool of the MCP server of the Symfony showcase app.
- 主要言語
- PHP
- スター
- 1.7k
- フォーク
- 206
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 102
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/php-sdk のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
modelcontextprotocol/php-sdk#746 ·
メンテナーはふだん 1 日以内に返信
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStanオープンServer
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
modelcontextprotocol/php-sdk#468 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement P3
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
modelcontextprotocol/php-sdk#733 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Server] Handle notifications/cancelled on the handshake era対応中かも @ump45nose が 5 日前に担当しました。 オープンhelp wanted improves spec compliance Server
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
modelcontextprotocol/php-sdk#732 ·
メンテナーはふだん 1 日以内に返信
-
[Client][Server] Ship extension classes for the two authorization extensions対応中かも @chr-hertel が 6 日前に担当しました。 オープンauth Client Server
modelcontextprotocol/php-sdk#721 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
modelcontextprotocol/php-sdk の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
pluginsGLPI/carbon#396 ·
-
[BUG] Bundle products lose their price in RSS feeds: getPrices() was removed対応中かも @pcvelz が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenMage/magento-lts#5869 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
OpenGIS/waymark-wp#82 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
claude
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
sprain/sprainocchio#39 ·
メンテナーはふだん 1 日以内に返信