File tree Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Original file line number Diff line number Diff line change 219219 (json-rpc/send-message context (json-rpc/notification " cancelled"
220220 {:requestId request-id})))
221221
222- (defn notify-root-list-updated
223- " Notifies the MCP server that the client's root list has been updated .
222+ (defn notify-root-list-changed
223+ " Notifies the MCP server that the client's root list has been changed .
224224 (see https://modelcontextprotocol.io/specification/2025-06-18/client/roots#root-list-changes)
225225
226226 Args:
231231 [context]
232232 (json-rpc/send-message context (json-rpc/notification " roots/list_changed" )))
233233
234+ (defn add-root
235+ " Adds a root to the client's root registry and notifies the server.
236+
237+ Args:
238+ context - The client session context
239+ root - Root map with :uri key and other root configuration
240+
241+ Returns:
242+ nil"
243+ [context root]
244+ (let [{:keys [session]} context]
245+ (swap! session update :root-by-uri assoc (:uri root) root)
246+ (notify-root-list-changed context))
247+ nil )
248+
249+ (defn remove-root
250+ " Removes a root from the client's root registry and notifies the server.
251+
252+ Args:
253+ context - The client session context
254+ root - Root map with :uri key to identify which root to remove
255+
256+ Returns:
257+ nil"
258+ [context root]
259+ (let [{:keys [session]} context]
260+ (swap! session update :root-by-uri dissoc (:uri root))
261+ (notify-root-list-changed context))
262+ nil )
263+
234264(defn send-first-handshake-message
235265 " Sends the initial handshake message to establish the MCP connection.
236266 Initializes the session with server capabilities and triggers the on-initialized callback
You can’t perform that action at this time.
0 commit comments