Repository navigation
Description
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'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.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
- After disconnecting from server A and connecting to server B, the Tools / Prompts / Resources result panels show their empty state, not the previous session's result.
-
currentLogLevelresets to\"info\"on disconnect so the Logs screen doesn't carry server A's level into server B. - Disconnect-driven clearing fires for all three disconnect paths already handled by the existing listener: explicit toggle, header Disconnect button, and mid-session transport failure.
-
App.test.tsxcovers the disconnect → state-cleared transition for at least the tool-call panel.
Activity
sampathreddy22 commentedon May 31, 2026
Implemented a fix in sampathreddy22/inspector — PR #1391.
The core change is a
useEffectinApp.tsxkeyed onconnectionStatusthat resets session state when the connection drops ("disconnected"or"error"). This covers the call-panel results and log level as described in the issue.One additional thing I noticed while testing locally: after reconnecting to a different server, the previous server's tool list was still visible in the Tools panel until the new server's list loaded. So the fix also clears
tools,prompts,resources,resourceTemplates, and their corresponding selection state (selectedTool,selectedPrompt,selectedResource) on disconnect. The new server repopulates these via its normallist*calls on connect, so the only visible difference is the panel briefly shows empty state rather than stale data from the previous session.All three disconnect paths are covered: explicit disconnect, reconnect toggle, and mid-session transport failure.
test(app): assert all four panels reset on disconnect (#1368)
fix(app): clear per-call panels and log level on disconnect (#1368) (#…
feat(web): tool progress toasts + persist all per-screen state across…