Use roots cache in get-roots-list tool

* In get-roots-list.ts, query the server's cache of the latest roots from the client and only request the list from the client if it doesn't exist.
* In roots.ts, export the roots map
This commit is contained in:
cliffhall
2025-12-13 15:42:24 -05:00
parent 6854902775
commit e1c1dcfac8

View File

@@ -19,9 +19,8 @@ const config = {
* The registered tool interacts with the MCP roots capability, which enables the server to access * The registered tool interacts with the MCP roots capability, which enables the server to access
* information about the client's workspace directories or file system roots. * information about the client's workspace directories or file system roots.
* *
* When supported by the client, the server automatically retrieves and formats the current list * When supported, the server automatically retrieves and formats the current list of roots from the
* of roots from the client upon connection and whenever the client sends a `roots/list_changed` * client upon connection and whenever the client sends a `roots/list_changed` notification.
* notification.
* *
* Therefore, this tool displays the roots that the server currently knows about for the connected * Therefore, this tool displays the roots that the server currently knows about for the connected
* client. If for some reason the server never got the initial roots list, the tool will request the * client. If for some reason the server never got the initial roots list, the tool will request the