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

Aperta Adatta ai principianti
#3,554 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
79/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api, documentation

Direzione di ricerca

Individua la sezione Output Schema nella specifica MCP e leggi i requisiti esistenti per i risultati del server e la convalida del client. Aggiungi una nota non normativa che spieghi come i server possono far evolvere gli schemi di output mentre i client possono conservarne copie nella cache, usando la formulazione proposta come punto di partenza. Controlla lo stile delle sezioni circostanti della specifica e assicurati che la nota affronti la compatibilità; la questione del nuovo recupero da parte del client è ancora aperta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
9.8k
Fork
1.9k
Merge medio
2g 4h
PR unite (30g)
73

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/modelcontextprotocol

Tutte le issue di modelcontextprotocol/modelcontextprotocol

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.