pub enum ToolNameError {
InvalidFormat {
name: String,
},
DisallowedCharacter {
name: String,
code_point: u32,
},
}Expand description
Error returned when a candidate string fails the invariant ToolName::new enforces.
Every variant’s #[error(...)] message formats its stored string field with {:?}
(Debug), not {} (Display) — see ServerIdError’s doc comment for why this is a
required second layer of defense, not incidental formatting, and must not be “simplified”
away.
§Examples
use mcp_execution_core::{ToolName, ToolNameError};
let err = ToolName::new("").unwrap_err();
assert!(matches!(err, ToolNameError::InvalidFormat { .. }));Variants§
InvalidFormat
name is not a single non-empty path segment: it is empty, or contains a .., a path
separator, or a root/prefix component.
Fields
name: StringSanitized form of the rejected input (see
sanitize_untrusted_inline):
control characters, bidi-reordering characters, and other invisible/structural
characters are neutralized, and &/</> are entity-escaped, since this value is
attacker-controlled and reaches LLM-facing error text.
DisallowedCharacter
name is a well-formed path segment but contains a character that is not UTS #39
Identifier_Status=Allowed (see crate::first_disallowed_identifier_char).
Fields
name: StringSanitized form of the rejected input (see
sanitize_untrusted_inline):
control characters, bidi-reordering characters, and other invisible/structural
characters are neutralized, and &/</> are entity-escaped, since this value is
attacker-controlled and reaches LLM-facing error text.
Trait Implementations§
Source§impl Clone for ToolNameError
impl Clone for ToolNameError
Source§fn clone(&self) -> ToolNameError
fn clone(&self) -> ToolNameError
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 ToolNameError
impl Debug for ToolNameError
Source§impl Display for ToolNameError
impl Display for ToolNameError
impl Eq for ToolNameError
Source§impl Error for ToolNameError
impl Error for ToolNameError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()