Ajv defaults: non-standard "format": "json" in third-party schemas (e.g. Notion) warns twice per property — register it like #2601
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
SDKのバリデーターモジュール内のcreateDefaultAjvInstance関数を確認してください。この問題は、警告を抑制するためにAjvインスタンスに'json'のno-opフォーマットを追加することに関するものです。参考として、issue #2601で'google-duration'がどのように登録されたかを確認してください。変更には、デフォルトのバリデーターの設定を修正して、3つの方言エンジン(Ajv2020、Ajv2019、Ajv)すべてにajv.addFormat('json', true)を含めることが含まれます。変更後、提供された再現コードでテストを行い、警告が消えていることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Context
This is the same class of noise as #2601 (google-duration), with an instance found in the wild.
The Notion MCP server's post-page tool annotates two string properties with "format": "json" — a value that is defined neither by JSON Schema nor by ajv-formats. Compiling that inputSchema through the default validator instances of @modelcontextprotocol/client@2.0.0 (createDefaultAjvInstance: { strict: false, allErrors: true } + ajv-formats) logs, per compile:
unknown format "json" ignored in schema at path "#/properties/icon"
unknown format "json" ignored in schema at path "#/properties/icon"
unknown format "json" ignored in schema at path "#/properties/cover"
unknown format "json" ignored in schema at path "#/properties/cover"
Two lines per property, because allErrors: true makes Ajv compile the format check twice — i.e. connecting to that one server costs 4 lines of client-side warning output per session.
It is not purely cosmetic: with Ajv's own defaults (strict: true) the same schema throws during compile (Error: unknown format "json" ignored in schema at path "#/properties/icon"), so any integrator who wants a strict validator cannot load that tool.
Ask
- Register
jsonas a no-op format (ajv.addFormat("json", true)) increateDefaultAjvInstance, for all three dialect engines, alongside thegoogle-durationregistration proposed in #2601; or - Downgrade the unknown-format message to debug-level output, so quirks in third-party schemas don't surface as user-visible warnings.
Note on custom validator providers
Consumers that pass their own Ajv instance to AjvJsonSchemaValidator bypass the default instances entirely, so registering formats there does not help them — e.g. a downstream extension that constructs its own validator provider still gets the warnings until it registers json itself. Worth a line in the validator docs.
Environment / reproduction
@modelcontextprotocol/client 2.0.0 · ajv 8.20.0 · node 24.12.0
import Ajv2020 from "ajv/dist/2020.js";
import addFormats from "ajv-formats";
const ajv = new Ajv2020({ strict: false, allErrors: true }); // mirrors createDefaultAjvInstance
addFormats(ajv);
ajv.compile({
type: "object",
properties: {
icon: { type: "string", format: "json" },
cover: { type: "string", format: "json" },
},
});
// -> the four "unknown format" lines above
Filed after reproducing the behaviour locally with the reporter's coding agent; outputs above are from that run and can be provided on request.
- 主要言語
- TypeScript
- スター
- 13.4k
- フォーク
- 2.2k
- 平均マージ
- 4日 18時間
- マージ済み PR(30日)
- 6
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/typescript-sdk のほかの issue
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
Auth metadata discovery: fallback URL built on resource host instead of authorization-server host オープンv1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/typescript-sdk#2783 · コメント 1 件 ·
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
modelcontextprotocol/typescript-sdk#2773 · コメント 1 件 ·
-
v2
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
modelcontextprotocol/typescript-sdk#2766 · コメント 1 件 ·
modelcontextprotocol/typescript-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mksglu/context-mode#1200 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/claude-code#96687 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
AOSSIE-Org/DebateAI#582 · コメント 2 件 ·
-
📕documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
db-ux-design-system/core-web#8239 ·