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
Source§fn clone(&self) -> ToolAnnotations
fn clone(&self) -> ToolAnnotations
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more