pub struct ToolError(/* private fields */);Expand description
A tool-execution failure, reported as isError tool content.
MCP separates protocol faults (unknown tool, arguments that do not match
the schema – rejected before a tool body ever runs) from failures a tool
body discovers itself. Only the first belongs in the JSON-RPC error
field; the second is data the model reads and acts on, which is what
rmcp::model::CallToolResult::is_error is for. Every helper below
builds one of these instead of a raw ErrorData, so a tool signature
that returns Result<_, ToolError> cannot surface a tmux or input
refusal as a protocol error by construction.
Public, and re-exported at the crate root: a caller that invokes
crate::TmuxTools’s methods directly, rather than over the wire, gets
this type back and needs Self::into_error_data to read it.
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn into_error_data(self) -> ErrorData
pub fn into_error_data(self) -> ErrorData
Recover the underlying ErrorData.
For the one caller that reports a nested tool’s own failure inside a
batch item rather than as this tool’s failure
(crate::TmuxTools::call_read_tools_batch), and for a
test that calls a tool directly and inspects the classification a
wire client would otherwise read from isError content.
Trait Implementations§
Source§impl Display for ToolError
The message a model would read, so a direct caller can propagate a tool
failure with ? like any other error.
impl Display for ToolError
The message a model would read, so a direct caller can propagate a tool
failure with ? like any other error.
Source§impl Error for ToolError
impl Error for ToolError
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()