Summary
The Tools / Prompts / Resources result panels and other per-session UI state are not cleared when the active InspectorClient disconnects, so the stale result of the last call against the previous server is shown in the next server's screens after the user reconnects.
Repro:
- Connect to server A (e.g.
PlotRocket).
- From the Tools screen, run
get_acts — the Results panel shows { "acts": [] }.
- Disconnect.
- Connect to server B (e.g.
nightrider) and navigate to Tools.
- Expected: Results panel is empty (
"Results will appear here").
- Actual: Results panel still shows
{ "acts": [] } from server A's get_acts call, alongside server B's tool list.
The same shape of bug applies to the prompt and resource result panels — their state lives in App.tsx and survives a disconnect/reconnect cycle.
Root cause
App.tsx owns several pieces of session-scoped UI state that are independent of the per-server state managers (managedToolsState, etc.) and are only ever cleared by their explicit onClear* handlers:
toolCallState (App.tsx:220)
getPromptState (App.tsx:223)
readResourceState (App.tsx:226)
currentLogLevel (App.tsx:214) — optimistic value, no echo to reset it
The existing disconnect listener at App.tsx:313-322 only resets activeServerId; it doesn't touch these. latencyMs is already reset correctly via the connectionStatus effect at App.tsx:284-286 — that's the pattern to follow.
The per-server state managers (managedToolsState etc.) are destroyed inside setupClientForServer when the user switches targets, but the call-panel state above sits one level up and isn't part of that teardown.
Proposed change
Extend the disconnect listener in App.tsx:313-322 (or add a sibling effect keyed on connectionStatus) to also clear:
setToolCallState(undefined)
setGetPromptState(undefined)
setReadResourceState(undefined)
setCurrentLogLevel(\"info\") — back to the default the next session will start at
Audit App.tsx for any other session-scoped UI state that should reset on disconnect (e.g. errorMessage — already cleared in places, but worth a pass) and clear those too. The per-server state-manager destroys in setupClientForServer should remain unchanged.
Acceptance criteria
Summary
The Tools / Prompts / Resources result panels and other per-session UI state are not cleared when the active InspectorClient disconnects, so the stale result of the last call against the previous server is shown in the next server's screens after the user reconnects.
Repro:
PlotRocket).get_acts— the Results panel shows{ "acts": [] }.nightrider) and navigate to Tools."Results will appear here").{ "acts": [] }from server A'sget_actscall, alongside server B's tool list.The same shape of bug applies to the prompt and resource result panels — their state lives in
App.tsxand survives a disconnect/reconnect cycle.Root cause
App.tsxowns several pieces of session-scoped UI state that are independent of the per-server state managers (managedToolsState, etc.) and are only ever cleared by their explicitonClear*handlers:toolCallState(App.tsx:220)getPromptState(App.tsx:223)readResourceState(App.tsx:226)currentLogLevel(App.tsx:214) — optimistic value, no echo to reset itThe existing disconnect listener at
App.tsx:313-322only resetsactiveServerId; it doesn't touch these.latencyMsis already reset correctly via theconnectionStatuseffect atApp.tsx:284-286— that's the pattern to follow.The per-server state managers (
managedToolsStateetc.) are destroyed insidesetupClientForServerwhen the user switches targets, but the call-panel state above sits one level up and isn't part of that teardown.Proposed change
Extend the
disconnectlistener inApp.tsx:313-322(or add a sibling effect keyed onconnectionStatus) to also clear:setToolCallState(undefined)setGetPromptState(undefined)setReadResourceState(undefined)setCurrentLogLevel(\"info\")— back to the default the next session will start atAudit
App.tsxfor any other session-scoped UI state that should reset on disconnect (e.g.errorMessage— already cleared in places, but worth a pass) and clear those too. The per-server state-manager destroys insetupClientForServershould remain unchanged.Acceptance criteria
currentLogLevelresets to\"info\"on disconnect so the Logs screen doesn't carry server A's level into server B.App.test.tsxcovers the disconnect → state-cleared transition for at least the tool-call panel.