Skip to content

Commit 28f2de4

Browse files
committed
feat: small constructor updates for Roots
1 parent 656a09a commit 28f2de4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/rmcp/src/model.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,6 +2378,20 @@ pub struct Root {
23782378
pub name: Option<String>,
23792379
}
23802380

2381+
impl Root {
2382+
pub fn new(uri: impl Into<String>) -> Self {
2383+
Self {
2384+
uri: uri.into(),
2385+
name: None,
2386+
}
2387+
}
2388+
2389+
pub fn with_name(mut self, name: impl Into<String>) -> Self {
2390+
self.name = Some(name.into());
2391+
self
2392+
}
2393+
}
2394+
23812395
const_string!(ListRootsRequestMethod = "roots/list");
23822396
pub type ListRootsRequest = RequestNoParam<ListRootsRequestMethod>;
23832397

@@ -2389,6 +2403,12 @@ pub struct ListRootsResult {
23892403
pub roots: Vec<Root>,
23902404
}
23912405

2406+
impl ListRootsResult {
2407+
pub fn new(roots: Vec<Root>) -> Self {
2408+
Self { roots }
2409+
}
2410+
}
2411+
23922412
const_string!(RootsListChangedNotificationMethod = "notifications/roots/list_changed");
23932413
pub type RootsListChangedNotification = NotificationNoParam<RootsListChangedNotificationMethod>;
23942414

0 commit comments

Comments
 (0)