Skip to content

feat: handle tools/resources/prompts list_changed notifications#1181

Open
travisbreaks wants to merge 1 commit intomodelcontextprotocol:mainfrom
travisbreaks:feat/handle-list-changed-notifications
Open

feat: handle tools/resources/prompts list_changed notifications#1181
travisbreaks wants to merge 1 commit intomodelcontextprotocol:mainfrom
travisbreaks:feat/handle-list-changed-notifications

Conversation

@travisbreaks
Copy link
Copy Markdown

Summary

  • Add handlers for notifications/tools/list_changed, notifications/resources/list_changed, and notifications/prompts/list_changed in the onNotification callback
  • Each handler clears stale state (lists, pagination cursors, cached output schemas) before re-fetching, matching the clear-then-list pattern used by the UI's manual refresh buttons
  • Add 3 unit tests verifying notification-triggered re-fetches

Test plan

  • All 490 unit tests pass (npm test)
  • Lint clean (npm run lint)
  • Prettier clean (npm run prettier-check)
  • Manual: connect to an MCP server that supports dynamic tool registration, add/remove a tool, verify the Tools tab auto-refreshes
  • Same manual flow for resources and prompts

Fixes #832

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

🤖 Generated with Claude Code

When a server sends notifications/tools/list_changed,
notifications/resources/list_changed, or notifications/prompts/list_changed,
the inspector now clears stale state (lists, pagination cursors, and cached
output schemas) and re-fetches from page 1. This follows the same
clear-then-list pattern used by the UI's manual refresh buttons.

The notification schemas were already imported and registered on the MCP
client in useConnection.ts; this connects the missing response logic in
the onNotification callback.

Fixes modelcontextprotocol#832

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Proposal: support tools/list_changed notifications handling

1 participant