pub struct Root {
pub uri: String,
pub name: Option<String>,
pub meta: Option<Value>,
}Expand description
Represents a root directory or file that the server can operate on.
Roots allow clients to expose filesystem roots to servers, enabling:
- Scoped file access
- Workspace awareness
- Security boundaries
§Example
use tower_mcp_types::protocol::Root;
let root = Root::new("file:///home/user/project");
assert_eq!(root.uri, "file:///home/user/project");
assert!(root.name.is_none());
let root = Root::with_name("file:///workspace", "My Project");
assert_eq!(root.name.unwrap(), "My Project");Fields§
§uri: StringThe URI identifying the root. Must start with file:// for now.
name: Option<String>Optional human-readable name for the root
meta: Option<Value>Optional protocol-level metadata
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Root
impl<'de> Deserialize<'de> for Root
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Root, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Root, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Root
impl Serialize for Root
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Root
impl RefUnwindSafe for Root
impl Send for Root
impl Sync for Root
impl Unpin for Root
impl UnsafeUnpin for Root
impl UnwindSafe for Root
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more