From 482d48d5bf609aa7111fe5125d66afccfde78272 Mon Sep 17 00:00:00 2001 From: Christian Sidak Date: Sun, 12 Apr 2026 11:23:38 -0700 Subject: [PATCH] feat: handle tools/resources/prompts list_changed notifications Add handlers for notifications/tools/list_changed, notifications/resources/list_changed, and notifications/prompts/list_changed in the onNotification callback. When a server sends these notifications, the inspector now resets pagination cursors and re-fetches the corresponding lists, enabling dynamic tool/resource/prompt registration use cases such as gateway MCP servers that load/unload capabilities at runtime. Fixes #832 --- client/src/App.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/client/src/App.tsx b/client/src/App.tsx index 59d15ba06..181aea91d 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -401,6 +401,27 @@ const App = () => { onNotification: (notification) => { setNotifications((prev) => [...prev, notification as ServerNotification]); + if (notification.method === "notifications/tools/list_changed") { + setNextToolCursor(undefined); + setTools([]); + void listTools(); + } + + if (notification.method === "notifications/resources/list_changed") { + setNextResourceCursor(undefined); + setNextResourceTemplateCursor(undefined); + setResources([]); + setResourceTemplates([]); + void listResources(); + void listResourceTemplates(); + } + + if (notification.method === "notifications/prompts/list_changed") { + setNextPromptCursor(undefined); + setPrompts([]); + void listPrompts(); + } + if (notification.method === "notifications/tasks/list_changed") { void listTasks(); }