-
Notifications
You must be signed in to change notification settings - Fork 472
Open
Labels
T-coreCore library changesCore library changes
Description
Root and ListRootsResult were made #[non_exhaustive] in 1.x but no constructors were added, making it impossible to implement ClientHandler::list_roots without going through serde_json::from_value:
// This no longer compiles
let root = Root { uri: "file:///project".into(), name: None };
// Current workaround
let root: Root = serde_json::from_value(json!({ "uri": "file:///project" })).unwrap();Same for ListRootsResult: the only way to return a non-empty result from list_roots is to deserialize it.
Most types affected by the #[non_exhaustive] change got ::new() + builder methods (e.g. CallToolRequestParams, ServerInfo). These two seem to have been missed, likely because the library's own code only deserializes them (roots flow from client to server over the wire).
Would be great to have something like:
Root::new(uri: impl Into<String>) // name defaults to None
ListRootsResult::new(roots: Vec<Root>)Neither type appears in the migration guide.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T-coreCore library changesCore library changes