feat(mcp): verify and guarantee list_changed on madt_enable dynamic domain loading #7

Closed
opened 2026-07-11 21:09:04 +00:00 by hexajon · 2 comments
hexajon commented 2026-07-11 21:09:04 +00:00 (Migrated from codeberg.org)

Part of #10.

Claude Code honors notifications/tools/list_changed (and the prompts/resources variants): "Claude Code automatically refreshes the available capabilities from that server" (docs, verified 2026-07-06). madtea's madt_enable loads gated domains (admin, users, hooks, …) mid-session — exactly the dynamic-registration case — but whether the go-sdk emits list_changed when tools are added post-initialize has never been verified for our wiring.

Acceptance criteria

  • Determine whether modelcontextprotocol/go-sdk v1.6+ auto-emits tools/list_changed on AddTool after connect; if not, emit it explicitly after madt_enable registers a domain
  • Server declares the listChanged: true tools capability
  • Integration test: connect a client, call madt_enable, assert the notification arrives and tools/list reflects the new domain
  • Live check in Claude Code: enabling a gated domain surfaces its tools in the same session without /mcp reconnect
  • madt_enable's result text / steering updated if the "restart to see tools" caveat (if any) becomes obsolete
Part of #10. Claude Code honors `notifications/tools/list_changed` (and the prompts/resources variants): "Claude Code automatically refreshes the available capabilities from that server" (docs, verified 2026-07-06). madtea's `madt_enable` loads gated domains (admin, users, hooks, …) mid-session — exactly the dynamic-registration case — but whether the go-sdk emits list_changed when tools are added post-initialize has never been verified for our wiring. ## Acceptance criteria - [ ] Determine whether `modelcontextprotocol/go-sdk` v1.6+ auto-emits tools/list_changed on AddTool after connect; if not, emit it explicitly after madt_enable registers a domain - [ ] Server declares the `listChanged: true` tools capability - [ ] Integration test: connect a client, call madt_enable, assert the notification arrives and tools/list reflects the new domain - [ ] Live check in Claude Code: enabling a gated domain surfaces its tools in the same session without /mcp reconnect - [ ] madt_enable's result text / steering updated if the "restart to see tools" caveat (if any) becomes obsolete
hexajon commented 2026-07-11 22:08:49 +00:00 (Migrated from codeberg.org)

Landed in a later PR (2026-07-09). The verify-and-guarantee outcome: the wiring was already correct — go-sdk v1.6.1 auto-emits tools/list_changed from AddTool on a connected server (server.go:282, 10ms debounce) and auto-infers the listChanged: true capability; madt_enable's dynamic registration flows through the same addTool chokepoint as static registration (which also means the outputSchema stamping covers dynamically-loaded tools — test-proven with the hooks domain). Three integration tests now pin all of it; result text and help already said "available immediately" and are now evidence-backed.

The one criterion left (why this stays open): the live Claude Code check — in a real session, madt_enable domains=["hooks"] (or any gated domain) and confirm the domain's tools are callable the SAME session without a /mcp reconnect. One interactive session on a post-v0.14.24 binary closes this.

Landed in a later PR (2026-07-09). The verify-and-guarantee outcome: **the wiring was already correct** — go-sdk v1.6.1 auto-emits `tools/list_changed` from `AddTool` on a connected server (server.go:282, 10ms debounce) and auto-infers the `listChanged: true` capability; madt_enable's dynamic registration flows through the same `addTool` chokepoint as static registration (which also means the outputSchema stamping covers dynamically-loaded tools — test-proven with the hooks domain). Three integration tests now pin all of it; result text and help already said "available immediately" and are now evidence-backed. **The one criterion left (why this stays open):** the live Claude Code check — in a real session, `madt_enable domains=["hooks"]` (or any gated domain) and confirm the domain's tools are callable the SAME session without a `/mcp` reconnect. One interactive session on a post-v0.14.24 binary closes this.
hexajon commented 2026-07-15 16:24:42 +00:00 (Migrated from codeberg.org)

Live check completed 2026-07-15 in a real Claude Code session on the v0.15.1 binary — the one criterion that was holding this open. Sequence: madt_enable domains=["hooks"] returned "Enabled 1 domain(s): hooks — new tools are now available"; the client surfaced madt_hooks in the same session with no /mcp reconnect; madt_hooks action=list executed successfully against the live repo ("No webhooks found" — correct, none configured). tools/list_changed → automatic client capability refresh → same-session callability, end to end. All other criteria were already machine-verified per the 2026-07-12 comment (go-sdk v1.6.1 auto-emits from AddTool, listChanged capability auto-inferred, three integration tests pin it).

Live check completed 2026-07-15 in a real Claude Code session on the v0.15.1 binary — the one criterion that was holding this open. Sequence: `madt_enable domains=["hooks"]` returned "Enabled 1 domain(s): hooks — new tools are now available"; the client surfaced `madt_hooks` in the same session with no /mcp reconnect; `madt_hooks action=list` executed successfully against the live repo ("No webhooks found" — correct, none configured). tools/list_changed → automatic client capability refresh → same-session callability, end to end. All other criteria were already machine-verified per the 2026-07-12 comment (go-sdk v1.6.1 auto-emits from AddTool, listChanged capability auto-inferred, three integration tests pin it).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#7
No description provided.