MCP prompts/list failure wipes the cached prompt list and announces it as empty
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- devtools
Research direction
The bug is in packages/core/src/mcp/index.ts around lines 305-312, where refreshPrompts handles a failed prompts/list call. Compare with refreshTools above it. The failing test is in packages/core/test/mcp.test.ts using the resourceServer fixture. Run the test to see the failure, then modify the Effect.orElseSucceed logic to preserve the existing prompts on error, similar to refreshTools.
Written by the indexing model from the issue text.
Description
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:
- Connect; the initial listing succeeds and
service.prompts()containsgreet. - The server sends
prompts/list_changed; the client re-lists and the server answers with the error. service.prompts()is now[], whileservice.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.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 9h 42m
- Merged PRs (30d)
- 389
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
All issues in anomalyco/opencode
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bcgov/bc-wallet-mobile#4761 · 1 comment ·
-
external-issue to-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
refactor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100