pub struct ToolOutput {
pub text: String,
pub original_tokens: usize,
pub saved_tokens: usize,
pub mode: Option<String>,
pub path: Option<String>,
pub changed: bool,
pub shell_outcome: Option<ShellOutcome>,
pub content_blocks: Option<Vec<ContentBlock>>,
}Expand description
Result returned by an McpTool handler.
Fields§
§text: String§original_tokens: usize§saved_tokens: usize§mode: Option<String>§path: Option<String>Path associated with the tool call (for record_call_with_path).
changed: boolTrue when the tool mutated state that clients should know about (e.g. dynamic tool categories changed).
shell_outcome: Option<ShellOutcome>Set by shell-executing tools so dispatch can populate isError +
structuredContent on the MCP result (GitHub #389). None for tools
that don’t run shell commands.
content_blocks: Option<Vec<ContentBlock>>Override content blocks for non-text responses (e.g. images).
When set, dispatch uses these instead of wrapping text in TextContent.
Implementations§
Source§impl ToolOutput
impl ToolOutput
pub fn simple(text: String) -> Self
Sourcepub fn to_header_line(&self, tool_name: &str) -> String
pub fn to_header_line(&self, tool_name: &str) -> String
Compact one-line summary for headers_only response verbosity.
pub fn with_savings(text: String, original: usize, saved: usize) -> Self
Sourcepub fn image(blocks: Vec<ContentBlock>, path: String) -> Self
pub fn image(blocks: Vec<ContentBlock>, path: String) -> Self
Construct a ToolOutput for image/binary content blocks. Bypasses all text processing in the dispatch pipeline.
Auto Trait Implementations§
impl Freeze for ToolOutput
impl RefUnwindSafe for ToolOutput
impl Send for ToolOutput
impl Sync for ToolOutput
impl Unpin for ToolOutput
impl UnsafeUnpin for ToolOutput
impl UnwindSafe for ToolOutput
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
Converts
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> ⓘ
Converts
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