#[non_exhaustive]pub struct McpResourceResult {
pub result_type: Option<ResultType>,
pub ttl_ms: Option<u64>,
pub cache_scope: Option<CacheScope>,
pub contents: Vec<ResourceContents>,
pub meta: Option<MetaObject>,
}Expand description
Result containing the contents of a read resource
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.result_type: Option<ResultType>Result type discriminator (SEP-2322). Required by the spec schema
for servers implementing protocol version 2026-07-28, but optional
here because this type also models results from older protocol
versions, which do not carry the field: None means absent on the
wire, and per the spec “the client MUST treat the absent field as
"complete"”. Constructors default to Some(ResultType::COMPLETE);
the server handler clears the field when responding to peers that
negotiated an older version.
ttl_ms: Option<u64>Time, in milliseconds, that this result may be treated as fresh (SEP-2549). Required by spec version 2026-07-28, but optional here to maintain compatibility with older spec versions.
cache_scope: Option<CacheScope>Scope describing who may cache this result (SEP-2549). Required by spec version 2026-07-28, but optional here to maintain compatibility with older spec versions.
contents: Vec<ResourceContents>The actual content of the resource
meta: Option<MetaObject>Implementations§
Source§impl ReadResourceResult
impl ReadResourceResult
Sourcepub fn new(contents: Vec<ResourceContents>) -> ReadResourceResult
pub fn new(contents: Vec<ResourceContents>) -> ReadResourceResult
Create a new ReadResourceResult with the given contents.
Sourcepub fn with_ttl_ms(self, ttl_ms: u64) -> ReadResourceResult
pub fn with_ttl_ms(self, ttl_ms: u64) -> ReadResourceResult
Set the time, in milliseconds, that this result may be treated as fresh.
Sourcepub fn with_cache_scope(self, cache_scope: CacheScope) -> ReadResourceResult
pub fn with_cache_scope(self, cache_scope: CacheScope) -> ReadResourceResult
Set the cache scope for this result.
Trait Implementations§
Source§impl Clone for ReadResourceResult
impl Clone for ReadResourceResult
Source§fn clone(&self) -> ReadResourceResult
fn clone(&self) -> ReadResourceResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReadResourceResult
impl Debug for ReadResourceResult
Source§impl<'de> Deserialize<'de> for ReadResourceResult
impl<'de> Deserialize<'de> for ReadResourceResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReadResourceResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReadResourceResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ReadResourceResult
impl JsonSchema for ReadResourceResult
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more