pub struct ToolOutput {
pub content: String,
pub success: bool,
pub metadata: Option<Value>,
pub images: Vec<Attachment>,
pub error_kind: Option<ToolErrorKind>,
}Expand description
Tool execution output
Fields§
§content: StringOutput content (text or base64 for binary)
success: boolWhether execution was successful
metadata: Option<Value>Optional metadata
images: Vec<Attachment>Optional image attachments from tool execution (e.g., screenshots).
When present, these are included in the tool result message sent to the LLM as multi-modal content blocks alongside the text content.
error_kind: Option<ToolErrorKind>Optional structured discriminant for tool failures. Populated by
tools that can map their failure into a typed ToolErrorKind
(e.g. edit / patch on a WorkspaceError::VersionConflict).
Surfaced through ToolResult and ToolCallResult so SDK callers
can react programmatically without parsing the content string.
Implementations§
Source§impl ToolOutput
impl ToolOutput
pub fn success(content: impl Into<String>) -> Self
pub fn error(message: impl Into<String>) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Sourcepub fn with_images(self, images: Vec<Attachment>) -> Self
pub fn with_images(self, images: Vec<Attachment>) -> Self
Attach images to the tool output.
These will be included as multi-modal content blocks in the tool result message sent to the LLM.
Sourcepub fn with_error_kind(self, kind: ToolErrorKind) -> Self
pub fn with_error_kind(self, kind: ToolErrorKind) -> Self
Attach a typed error kind. Used by built-in tools when they can
map a backend failure (e.g. WorkspaceError::VersionConflict)
into a programmatically actionable ToolErrorKind.
Trait Implementations§
Source§impl Clone for ToolOutput
impl Clone for ToolOutput
Source§fn clone(&self) -> ToolOutput
fn clone(&self) -> ToolOutput
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 ToolOutput
impl Debug for ToolOutput
Source§impl<'de> Deserialize<'de> for ToolOutput
impl<'de> Deserialize<'de> for ToolOutput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ToolOutput> for ToolResult
impl From<ToolOutput> for ToolResult
Source§fn from(output: ToolOutput) -> Self
fn from(output: ToolOutput) -> Self
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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