pub struct Prompt {
pub name: String,
pub descr: Option<String>,
pub args: Option<Vec<PromptArgument>>,
pub title: Option<String>,
pub icons: Option<Vec<Icon>>,
pub meta: Option<Value>,
/* private fields */
}Expand description
A prompt or prompt template that the server offers.
See the schema for details
Fields§
§name: StringThe name of the prompt or prompt template.
descr: Option<String>An optional description of what this prompt provides
args: Option<Vec<PromptArgument>>A list of arguments to use for templating the prompt.
title: Option<String>Intended for UI and end-user contexts - optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.
If not provided, the name should be used for display (except for Tool,
where annotations.title should be given precedence over using name, if present).
icons: Option<Vec<Icon>>Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
meta: Option<Value>Metadata reserved by MCP for protocol-level metadata.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn new<F, R, Args>(name: impl Into<String>, handler: F) -> Selfwhere
F: PromptHandler<Args, Output = R>,
R: TryInto<GetPromptResult> + Send + 'static,
R::Error: Into<Error>,
Args: TryFrom<GetPromptRequestParams, Error = Error> + Send + Sync + 'static,
pub fn new<F, R, Args>(name: impl Into<String>, handler: F) -> Selfwhere
F: PromptHandler<Args, Output = R>,
R: TryInto<GetPromptResult> + Send + 'static,
R::Error: Into<Error>,
Args: TryFrom<GetPromptRequestParams, Error = Error> + Send + Sync + 'static,
Creates a new Prompt
Sourcepub fn with_title(&mut self, title: impl Into<String>) -> &mut Self
pub fn with_title(&mut self, title: impl Into<String>) -> &mut Self
Sets a Prompt title
Sourcepub fn with_description(&mut self, descr: impl Into<String>) -> &mut Self
pub fn with_description(&mut self, descr: impl Into<String>) -> &mut Self
Sets a Prompt description
Sourcepub fn with_icons(&mut self, icons: impl IntoIterator<Item = Icon>) -> &mut Self
pub fn with_icons(&mut self, icons: impl IntoIterator<Item = Icon>) -> &mut Self
Sets the Prompt icons
Sourcepub fn with_roles<T, I>(&mut self, roles: T) -> &mut Self
pub fn with_roles<T, I>(&mut self, roles: T) -> &mut Self
Sets a list of roles that are allowed to get the prompt
Sourcepub fn with_permissions<T, I>(&mut self, permissions: T) -> &mut Self
pub fn with_permissions<T, I>(&mut self, permissions: T) -> &mut Self
Sets a list of permissions that are allowed to get the prompt
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Prompt
impl<'de> Deserialize<'de> for Prompt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Prompt
impl !RefUnwindSafe for Prompt
impl Send for Prompt
impl Sync for Prompt
impl Unpin for Prompt
impl !UnwindSafe for Prompt
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)