fix/serve: one list_changed per source on reload and log dropped notifications #84
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/reload-batched-list-changed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #53. A policy reload used to call DeleteTools and then one AddTool per CLI tool, so mcp-go broadcast one tools/list_changed per tool plus one, and a session queue of 100 could fill up across two reloads close together. mcp-go drops the overflow silently unless an OnError hook exists, and wraptool had none. Each source is now re-registered with one batched AddTools call first, then DeleteTools only for the names that went away, so an approval reload sends exactly one notification, a reload that removed tools sends two, and tools never vanish from tools/list during the swap. A CLI listing error on reload fails closed and removes the CLI tools, since the swapped policy and the old handlers' tool config must not mix. New cmd/notifyhooks.go registers an OnError hook that logs a dropped notification with the session id and method. One log line per touched source reports registered and removed counts. Tests count notifications through a fake client session for add, remove, unchanged, reregister, fail-closed and the drop hook, and a reviewer pass with mutation checks is done. Docs updated in CLAUDE.md, docs/hot-reload.qmd, design/mcp-server-wrapping.md and the CHANGELOG. The issue stays open until a few approvals in a row reach a live Claude Code session without a reconnect. 🤖 Generated with Claude Code