pub struct McpJsonResourceSpec { /* private fields */ }Expand description
Validated static JSON resource ready to register on an McpServer.
Implementations§
Source§impl McpJsonResourceSpec
impl McpJsonResourceSpec
Sourcepub fn new(
uri: impl Into<String>,
name: impl Into<String>,
title: Option<String>,
description: Option<String>,
value: Value,
) -> Result<Self, McpToolError>
pub fn new( uri: impl Into<String>, name: impl Into<String>, title: Option<String>, description: Option<String>, value: Value, ) -> Result<Self, McpToolError>
Build and validate an application/json resource backed by value.
§Errors
Returns McpToolError when the resource URI, name, title, description,
or MIME type is invalid.
Sourcepub fn definition(&self) -> &ResourceDefinition
pub fn definition(&self) -> &ResourceDefinition
Resource definition advertised by resources/list.
Sourcepub fn into_definition(self) -> ResourceDefinition
pub fn into_definition(self) -> ResourceDefinition
Consume the spec and return its resource definition.
Trait Implementations§
Source§impl Clone for McpJsonResourceSpec
impl Clone for McpJsonResourceSpec
Source§fn clone(&self) -> McpJsonResourceSpec
fn clone(&self) -> McpJsonResourceSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for McpJsonResourceSpec
impl RefUnwindSafe for McpJsonResourceSpec
impl Send for McpJsonResourceSpec
impl Sync for McpJsonResourceSpec
impl Unpin for McpJsonResourceSpec
impl UnsafeUnpin for McpJsonResourceSpec
impl UnwindSafe for McpJsonResourceSpec
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