Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

MCP prompts/list failure wipes the cached prompt list and announces it as empty

Aperta Adatta ai principianti
#50,918 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devtools

Direzione di ricerca

Il bug si trova in packages/core/src/mcp/index.ts intorno alle righe 305-312, dove refreshPrompts gestisce una chiamata prompts/list fallita. Confronta con refreshTools sopra. Il test che fallisce è in packages/core/test/mcp.test.ts utilizzando il fixture resourceServer. Esegui il test per vedere l'errore, quindi modifica la logica Effect.orElseSucceed per preservare i prompt esistenti in caso di errore, simile a refreshTools.

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

Descrizione

Description

refreshPrompts turns a failed prompts/list into an empty list and then commits it: Effect.orElseSucceed(() => []) at packages/core/src/mcp/index.ts:307, and the Effect.map below it assigns entry.prompts from that empty result before publishing PromptsChanged (:305-312). refreshTools directly above (:298-303) has no such swallow, so a failed tools refresh leaves the registered tools alone. The two listings behave differently on the same failure.

So one transient error on a server that is still connected wipes its prompts, and the event that follows tells every reader the list is now legitimately empty — packages/core/src/plugin/command.ts:18-24 reacts to PromptsChanged by re-reading mcp.prompts() and calling ctx.command.reload(). The server's slash commands disappear and nothing indicates why: servers() still reports status: "connected".

Plugins

None.

OpenCode version

v2 at 681ea07a9.

Steps to reproduce

Using the resourceServer fixture in packages/core/test/mcp.test.ts, with prompts capability advertising listChanged and a responder that answers prompts/list with a JSON-RPC error once armed:

  1. Connect; the initial listing succeeds and service.prompts() contains greet.
  2. The server sends prompts/list_changed; the client re-lists and the server answers with the error.
  3. service.prompts() is now [], while service.servers() still reports { status: "connected" }.

Expected: the failed refresh keeps the prompts it already had, as refreshTools does. The regression test in the PR fails on 681ea07a9 with prompts were [] and passes with the one-line change.

Lingua principale
TypeScript
Stelle
209k
Fork
27.5k
Merge medio
9h 42m
PR unite (30g)
389

Guida per i contributori

Apri la guida per i contributori

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 anomalyco/opencode

Tutte le issue di anomalyco/opencode

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.