pub struct ToolAnnotations {
pub read_only_hint: Option<bool>,
pub destructive_hint: Option<bool>,
pub idempotent_hint: Option<bool>,
pub open_world_hint: Option<bool>,
}Expand description
Behavioral hints for a tool, per the MCP 2025-03-26 spec’s tool annotations. Clients (Claude Desktop and others) use these to decide whether to warn or ask for confirmation before calling a tool — e.g. skip confirmation for a read-only tool, or warn before a destructive one.
Every field is a hint, not something this server enforces or verifies —
nothing stops a handler registered with read_only_hint: Some(true) from
actually writing to disk. A well-behaved server sets these accurately;
a client is free to ignore them or ask for confirmation anyway.
Register with McpServer::tool_annotated. Build one with plain struct
syntax — every field defaults to None (no hint given, the client’s own
default applies):
use rust_web_server::mcp::ToolAnnotations;
let destructive = ToolAnnotations {
destructive_hint: Some(true),
read_only_hint: Some(false),
..Default::default()
};Fields§
§read_only_hint: Option<bool>The tool does not modify its environment.
destructive_hint: Option<bool>The tool may perform destructive updates (only meaningful when
read_only_hint is not Some(true)).
idempotent_hint: Option<bool>Calling the tool repeatedly with the same arguments has no additional effect beyond the first call.
open_world_hint: Option<bool>The tool may interact with an open-ended set of external entities (e.g. web search), as opposed to a fixed, closed set.
Trait Implementations§
Source§impl Clone for ToolAnnotations
impl Clone for ToolAnnotations
impl Copy for ToolAnnotations
Source§impl Debug for ToolAnnotations
impl Debug for ToolAnnotations
Auto Trait Implementations§
impl Freeze for ToolAnnotations
impl RefUnwindSafe for ToolAnnotations
impl Send for ToolAnnotations
impl Sync for ToolAnnotations
impl Unpin for ToolAnnotations
impl UnsafeUnpin for ToolAnnotations
impl UnwindSafe for ToolAnnotations
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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