diff --git a/docs/specification/draft/schema.mdx b/docs/specification/draft/schema.mdx
index 2e0e713a9..c2d6025ff 100644
--- a/docs/specification/draft/schema.mdx
+++ b/docs/specification/draft/schema.mdx
@@ -27,7 +27,7 @@ the data is entirely optional.
experimental?: { [key: string]: object }
roots?: { listChanged?: boolean }
+experimental?: { [key: string]: object }
### `ContentBlock`
@@ -221,7 +221,7 @@ other URI schemes. interface ServerCapabilities {
completions?: object;
experimental?: { [key: string]: object };
logging?: object;
prompts?: { listChanged?: boolean };
resources?: { listChanged?: boolean; subscribe?: boolean };
tools?: { listChanged?: boolean };
}experimental?: { [key: string]: object }
prompts?: { listChanged?: boolean }
resources?: { listChanged?: boolean; subscribe?: boolean }
tools?: { listChanged?: boolean }
+experimental?: { [key: string]: object }
prompts?: { listChanged?: boolean }
resources?: { listChanged?: boolean; subscribe?: boolean }
tools?: { listChanged?: boolean }
### `StringSchema`
@@ -367,14 +367,6 @@ Contains values matching the requested schema. _meta?: { [key: string]: unknown }
-## `notifications/roots/list_changed`
-
-### `RootsListChangedNotification`
-
-interface RootsListChangedNotification { jsonrpc: "2.0"; method: "notifications/roots/list_changed"; params?: NotificationParams;}
-
## `notifications/tools/list_changed`
### `ToolListChangedNotification`
@@ -472,17 +464,22 @@ If present, there may be more results available.
+
### `ListRootsResult`
-interface ListRootsResult { _meta?: { [key: string]: unknown }; roots: Root[]; [key: string]: unknown;} _meta?: { [key: string]: unknown }
+interface ListRootsResult { _meta?: { [key: string]: unknown }; roots: Root[]; [key: string]: unknown;} _meta?: { [key: string]: unknown }
+
+## `roots/set`
+
+### `SetRootsRequest`
+
+params: { roots: Root[] }
## `sampling/createMessage`
diff --git a/schema/draft/schema.json b/schema/draft/schema.json
index 469c6f2d7..1c7f75f0c 100644
--- a/schema/draft/schema.json
+++ b/schema/draft/schema.json
@@ -272,16 +272,6 @@
"description": "Experimental, non-standard capabilities that the client supports.",
"type": "object"
},
- "roots": {
- "description": "Present if the client supports listing roots.",
- "properties": {
- "listChanged": {
- "description": "Whether the client supports notifications for changes to the roots list.",
- "type": "boolean"
- }
- },
- "type": "object"
- },
"sampling": {
"additionalProperties": true,
"description": "Present if the client supports sampling from an LLM.",
@@ -301,9 +291,6 @@
},
{
"$ref": "#/definitions/ProgressNotification"
- },
- {
- "$ref": "#/definitions/RootsListChangedNotification"
}
]
},
@@ -347,6 +334,12 @@
},
{
"$ref": "#/definitions/CompleteRequest"
+ },
+ {
+ "$ref": "#/definitions/SetRootsRequest"
+ },
+ {
+ "$ref": "#/definitions/ListRootsRequest"
}
]
},
@@ -358,9 +351,6 @@
{
"$ref": "#/definitions/CreateMessageResult"
},
- {
- "$ref": "#/definitions/ListRootsResult"
- },
{
"$ref": "#/definitions/ElicitResult"
}
@@ -1399,7 +1389,7 @@
"type": "object"
},
"ListRootsRequest": {
- "description": "Sent from the server to request a list of root URIs from the client. Roots allow\nservers to ask for specific directories or files to operate on. A common example\nfor roots is providing a set of repositories or directories a server should operate\non.\n\nThis request is typically used when the server needs to understand the file system\nstructure or access specific locations that the client has permission to read from.",
+ "description": "Sent from the client to query the list of root URIs currently set on the server.\nThe server responds with the list of roots that were previously set via SetRootsRequest.",
"properties": {
"id": {
"$ref": "#/definitions/RequestId"
@@ -1424,7 +1414,7 @@
"type": "object"
},
"ListRootsResult": {
- "description": "The client's response to a roots/list request from the server.\nThis result contains an array of Root objects, each representing a root directory\nor file that the server can operate on.",
+ "description": "The server's response to a roots/list request from the client.\nThis result contains an array of Root objects representing the root directories\nor files currently configured on the server.",
"properties": {
"_meta": {
"additionalProperties": {},
@@ -2376,27 +2366,6 @@
],
"type": "object"
},
- "RootsListChangedNotification": {
- "description": "A notification from the client to the server, informing it that the list of roots has changed.\nThis notification should be sent whenever the client adds, removes, or modifies any root.\nThe server should then request an updated list of roots using the ListRootsRequest.",
- "properties": {
- "jsonrpc": {
- "const": "2.0",
- "type": "string"
- },
- "method": {
- "const": "notifications/roots/list_changed",
- "type": "string"
- },
- "params": {
- "$ref": "#/definitions/NotificationParams"
- }
- },
- "required": [
- "jsonrpc",
- "method"
- ],
- "type": "object"
- },
"SamplingMessage": {
"description": "Describes a message issued to or received from an LLM API.",
"properties": {
@@ -2471,6 +2440,12 @@
},
"type": "object"
},
+ "roots": {
+ "additionalProperties": true,
+ "description": "Present if the server supports accepting roots from the client.",
+ "properties": {},
+ "type": "object"
+ },
"tools": {
"description": "Present if the server offers any tools to call.",
"properties": {
@@ -2517,9 +2492,6 @@
{
"$ref": "#/definitions/CreateMessageRequest"
},
- {
- "$ref": "#/definitions/ListRootsRequest"
- },
{
"$ref": "#/definitions/ElicitRequest"
}
@@ -2556,6 +2528,9 @@
},
{
"$ref": "#/definitions/CompleteResult"
+ },
+ {
+ "$ref": "#/definitions/ListRootsResult"
}
]
},
@@ -2609,6 +2584,35 @@
],
"type": "object"
},
+ "SetRootsRequest": {
+ "description": "Sent from the client to the server to set the root directories or files that the server can operate on.\nThis replaces the entire list of roots with the new set provided.\nThe server responds with EmptyResult to acknowledge the roots have been set.",
+ "properties": {
+ "method": {
+ "const": "roots/set",
+ "type": "string"
+ },
+ "params": {
+ "properties": {
+ "roots": {
+ "description": "The new list of roots to set. This replaces any existing roots.",
+ "items": {
+ "$ref": "#/definitions/Root"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "roots"
+ ],
+ "type": "object"
+ }
+ },
+ "required": [
+ "method",
+ "params"
+ ],
+ "type": "object"
+ },
"StringSchema": {
"properties": {
"default": {
diff --git a/schema/draft/schema.ts b/schema/draft/schema.ts
index 9a246c8ec..26e6433a3 100644
--- a/schema/draft/schema.ts
+++ b/schema/draft/schema.ts
@@ -244,15 +244,6 @@ export interface ClientCapabilities {
* Experimental, non-standard capabilities that the client supports.
*/
experimental?: { [key: string]: object };
- /**
- * Present if the client supports listing roots.
- */
- roots?: {
- /**
- * Whether the client supports notifications for changes to the roots list.
- */
- listChanged?: boolean;
- };
/**
* Present if the client supports sampling from an LLM.
*/
@@ -271,6 +262,10 @@ export interface ServerCapabilities {
* Experimental, non-standard capabilities that the server supports.
*/
experimental?: { [key: string]: object };
+ /**
+ * Present if the server supports accepting roots from the client.
+ */
+ roots?: object;
/**
* Present if the server supports sending log messages to the client.
*/
@@ -1506,13 +1501,25 @@ export interface PromptReference extends BaseMetadata {
/* Roots */
/**
- * Sent from the server to request a list of root URIs from the client. Roots allow
- * servers to ask for specific directories or files to operate on. A common example
- * for roots is providing a set of repositories or directories a server should operate
- * on.
+ * Sent from the client to the server to set the root directories or files that the server can operate on.
+ * This replaces the entire list of roots with the new set provided.
+ * The server responds with EmptyResult to acknowledge the roots have been set.
*
- * This request is typically used when the server needs to understand the file system
- * structure or access specific locations that the client has permission to read from.
+ * @category roots/set
+ */
+export interface SetRootsRequest extends Request {
+ method: "roots/set";
+ params: {
+ /**
+ * The new list of roots to set. This replaces any existing roots.
+ */
+ roots: Root[];
+ };
+}
+
+/**
+ * Sent from the client to query the list of root URIs currently set on the server.
+ * The server responds with the list of roots that were previously set via SetRootsRequest.
*
* @category roots/list
*/
@@ -1522,9 +1529,9 @@ export interface ListRootsRequest extends JSONRPCRequest {
}
/**
- * The client's response to a roots/list request from the server.
- * This result contains an array of Root objects, each representing a root directory
- * or file that the server can operate on.
+ * The server's response to a roots/list request from the client.
+ * This result contains an array of Root objects representing the root directories
+ * or files currently configured on the server.
*
* @category roots/list
*/
@@ -1557,18 +1564,6 @@ export interface Root {
_meta?: { [key: string]: unknown };
}
-/**
- * A notification from the client to the server, informing it that the list of roots has changed.
- * This notification should be sent whenever the client adds, removes, or modifies any root.
- * The server should then request an updated list of roots using the ListRootsRequest.
- *
- * @category notifications/roots/list_changed
- */
-export interface RootsListChangedNotification extends JSONRPCNotification {
- method: "notifications/roots/list_changed";
- params?: NotificationParams;
-}
-
/**
* Parameters for an `elicitation/create` request.
*
@@ -1594,7 +1589,6 @@ export interface ElicitRequestParams extends RequestParams {
/**
* A request from the server to elicit additional information from the user via the client.
- *
* @category elicitation/create
*/
export interface ElicitRequest extends JSONRPCRequest {
@@ -1683,20 +1677,20 @@ export type ClientRequest =
| SubscribeRequest
| UnsubscribeRequest
| CallToolRequest
- | ListToolsRequest;
+ | ListToolsRequest
+ | SetRootsRequest
+ | ListRootsRequest;
/** @internal */
export type ClientNotification =
| CancelledNotification
| ProgressNotification
- | InitializedNotification
- | RootsListChangedNotification;
+ | InitializedNotification;
/** @internal */
export type ClientResult =
| EmptyResult
| CreateMessageResult
- | ListRootsResult
| ElicitResult;
/* Server messages */
@@ -1704,7 +1698,6 @@ export type ClientResult =
export type ServerRequest =
| PingRequest
| CreateMessageRequest
- | ListRootsRequest
| ElicitRequest;
/** @internal */
@@ -1728,4 +1721,5 @@ export type ServerResult =
| ListResourcesResult
| ReadResourceResult
| CallToolResult
- | ListToolsResult;
+ | ListToolsResult
+ | ListRootsResult;
elicitation?: object;
experimental?: { [key: string]: object };
roots?: { listChanged?: boolean };
sampling?: object;
}