Skip to content

fix: clear session-scoped UI state on server disconnect#1391

Closed
sampathreddy22 wants to merge 1 commit into
modelcontextprotocol:mainfrom
sampathreddy22:fix/clear-session-state-on-disconnect
Closed

fix: clear session-scoped UI state on server disconnect#1391
sampathreddy22 wants to merge 1 commit into
modelcontextprotocol:mainfrom
sampathreddy22:fix/clear-session-state-on-disconnect

Conversation

@sampathreddy22
Copy link
Copy Markdown

@sampathreddy22 sampathreddy22 commented May 31, 2026

Summary

When switching between servers, the Tools/Prompts/Resources result panels were still showing output from the previous session. The root cause is that App.tsx holds several pieces of session-scoped state that were never reset when the connection dropped.

Changes:

  • Added a useEffect keyed on connectionStatus that clears session state on "disconnected" or "error"
  • Resets call-panel results: toolResult, promptContent, resourceContent, resourceContentMap
  • Resets logLevel to "info"
  • Also clears the server-fetched lists (tools, prompts, resources, resourceTemplates) and their selection state — without this, the previous server's tool list was still visible in the Tools panel until the new server's list loaded

All three disconnect paths are covered: explicit disconnect, reconnect/restart toggle, and mid-session transport failure.

@cliffhall
Copy link
Copy Markdown
Member

Hi @sampathreddy22 The issue is against v2, which we are building on a separate branch. It is a completely different codebase.

@cliffhall cliffhall closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants