Output Schema: say how a server can change a tool's `outputSchema` without breaking clients that cached it

Offen Anfängerfreundlich
#3,554 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
79/100
Issue-Typ
Dokumentation
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
api, documentation

Rechercherichtung

Finde den Abschnitt Output Schema in der MCP-Spezifikation und lies die bestehenden Anforderungen an Serverergebnisse und die Client-Validierung. Füge einen nicht normativen Hinweis hinzu, der erklärt, wie Server Ausgabeschemas weiterentwickeln können, während Clients möglicherweise zwischengespeicherte Kopien haben, und verwende dabei die vorgeschlagene Formulierung als Ausgangspunkt. Prüfe den Stil der umgebenden Spezifikation und stelle sicher, dass der Hinweis die Kompatibilität behandelt; die Frage, ob der Client die Daten erneut abrufen soll, ist noch offen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

The Output Schema section says servers MUST return structured results that conform to the schema, and clients SHOULD validate them against it. It doesn't say which schema applies when the two sides hold different versions. Clients cache tool lists, so after a server changes a tool, a client can validate a new result against the old schema.

What happened to us: our server removed two fields that a tool's outputSchema had marked required. A Claude Code session and ChatGPT both still held the old schema, and both rejected every result from that tool until they reconnected. The results were valid against the current schema the whole time. ChatGPT also kept the old tool list until the user pressed "Refresh tools" in its settings.

notifications/tools/list_changed doesn't close the gap. It only helps clients that listen for it, and a call can still arrive before the refresh.

Proposed non-normative note under Output Schema:

Clients may hold a cached copy of a tool's outputSchema. To change it without breaking them, servers SHOULD only add optional properties. Removing, renaming or narrowing a property, or making one required, can cause clients holding the earlier schema to reject valid results. To replace a property, add the new one and keep the old one until clients have refreshed.

Open question: should a client refetch tools/list before treating a result that fails validation as a server error?

I'm happy to open a docs PR with this wording. Write-up: https://github.com/shawnbaako/production-agent-experiments/tree/main/studies/06-tool-search-results (Pitfalls).

AI disclosure: An AI coding agent (Claude Code) drafted this issue at my direction from our production logs and the linked write-up. I reviewed it and stand behind the facts.

Vorherrschende Sprache
TypeScript
Sterne
9.8k
Forks
1.9k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
73

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/modelcontextprotocol

Alle Issues in modelcontextprotocol/modelcontextprotocol

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.