pub struct DynamicResourceTemplate {
pub name: String,
pub description: String,
pub mime_type: Option<String>,
pub scope: Option<String>,
/* private fields */
}Expand description
A dynamic resource template a provider can serve, beyond the exact
uri_template strings already listed in catalog().resources (which
cover only static, parameter-free resources). Populated by file-based
dynamic resource readers under providers/resources/ — see
providers::resource_files.
Fields§
§name: StringHuman-readable template name advertised via MCP.
description: StringHuman-readable description of what the template resolves.
mime_type: Option<String>MIME type of the resolved content, if known.
scope: Option<String>Scope required to invoke this template, enforced the same way
ProviderResource::scope is enforced for static resources — see
ProviderRegistry::read_resource. None means no scope beyond
baseline Mounted authentication is required.
Implementations§
Source§impl DynamicResourceTemplate
impl DynamicResourceTemplate
Sourcepub fn uri_template(&self) -> String
pub fn uri_template(&self) -> String
The RFC 6570-flavored URI template string (e.g.
soma://resources/service/{name}) advertised via MCP
resources/templates/list. ResourcePath itself stays private to
this crate — this is the only piece other crates need.
Sourcepub fn from_path_segments(
segments: &[&str],
name: impl Into<String>,
description: impl Into<String>,
mime_type: Option<String>,
) -> Result<Self, String>
pub fn from_path_segments( segments: &[&str], name: impl Into<String>, description: impl Into<String>, mime_type: Option<String>, ) -> Result<Self, String>
Builds a template from raw path segments using the same bracket
syntax as providers/resources/*.ts filenames ([name] for a
parameter, [...name] for a catch-all — see
docs/contracts/drop-in-provider-layout.md). The public constructor
for any Provider (file-based or not) that wants to advertise a
dynamic resource template, since ResourcePath itself is private.
scope defaults to None; set the returned value’s scope field
directly to require one.
Trait Implementations§
Source§impl Clone for DynamicResourceTemplate
impl Clone for DynamicResourceTemplate
Source§fn clone(&self) -> DynamicResourceTemplate
fn clone(&self) -> DynamicResourceTemplate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DynamicResourceTemplate
impl RefUnwindSafe for DynamicResourceTemplate
impl Send for DynamicResourceTemplate
impl Sync for DynamicResourceTemplate
impl Unpin for DynamicResourceTemplate
impl UnsafeUnpin for DynamicResourceTemplate
impl UnwindSafe for DynamicResourceTemplate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more