From 92ee792363ce63cfac5b8397abc86fd1386cfe69 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Fri, 9 May 2025 20:21:15 -0400 Subject: [PATCH] internal/mcp: fix roots design Minor changes to the roots part of the design. Change-Id: I8125aecc5da297594f74d8d7dc5ef3d94dfa8519 Reviewed-on: https://go-review.googlesource.com/c/tools/+/671356 Reviewed-by: Robert Findley TryBot-Bypass: Jonathan Amsterdam --- design/design.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/design/design.md b/design/design.md index f04decc..a42b67f 100644 --- a/design/design.md +++ b/design/design.md @@ -575,16 +575,14 @@ type XXXParams struct { // where XXX is each type of call ``` Handlers can notify their peer about progress by calling the `NotifyProgress` -method. The notification is only sent if the peer requested it. +method. The notification is only sent if the peer requested it by providing +a progress token. ```go func (*ClientSession) NotifyProgress(context.Context, *ProgressNotification) func (*ServerSession) NotifyProgress(context.Context, *ProgressNotification) ``` -We don't support progress notifications for `Client.ListRoots`, because we expect -that operation to be instantaneous relative to network latency. - ### Ping / KeepAlive Both `ClientSession` and `ServerSession` expose a `Ping` method to call "ping" @@ -625,16 +623,15 @@ Clients support the MCP Roots feature out of the box, including roots-changed no Roots can be added and removed from a `Client` with `AddRoots` and `RemoveRoots`: ```go -// AddRoots adds the roots to the client's list of roots. -// If the list changes, the client notifies the server. -// If a root does not begin with a valid URI schema such as "https://" or "file://", -// it is intepreted as a directory path on the local filesystem. -func (*Client) AddRoots(roots ...string) +// AddRoots adds the given roots to the client, +// replacing any with the same URIs, +// and notifies any connected servers. +func (*Client) AddRoots(roots ...Root) -// RemoveRoots removes the given roots from the client's list, and notifies -// the server if the list has changed. +// RemoveRoots removes the roots with the given URIs. +// and notifies any connected servers if the list has changed. // It is not an error to remove a nonexistent root. -func (*Client) RemoveRoots(roots ...string) +func (*Client) RemoveRoots(uris ...string) ``` Servers can call `ListRoots` to get the roots. If a server installs a