Skip to main content

ListChangedCallback

Type Alias ListChangedCallback 

Source
pub type ListChangedCallback = Arc<dyn Fn() + Send + Sync + 'static>;
Expand description

Callback fired by Connection when the upstream MCP server emits notifications/tools/list_changed or notifications/resources/list_changed.

Timing: runs after the corresponding cache’s write lock is taken but before the network paginate that replaces it. That ordering matches the moment the staleness window opens — anyone blocked on the read lock won’t return until the new list lands. The callback should not call back into list_tools / list_resources: doing so would re-take the lock the listener already holds and deadlock.

Stored behind an Arc so the listener task can cheaply clone it out of the lock and call it without holding the read guard.

Aliased Type§

pub struct ListChangedCallback { /* private fields */ }