pub struct ToolResult {
pub name: String,
pub output: String,
pub exit_code: i32,
pub metadata: Option<Value>,
pub images: Vec<Attachment>,
pub error_kind: Option<ToolErrorKind>,
pub trust: ToolResultTrustV1,
}Expand description
Tool execution result returned by direct tool execution.
Fields§
§name: String§output: String§exit_code: i32§metadata: Option<Value>§images: Vec<Attachment>Image attachments from tool execution (multi-modal output).
error_kind: Option<ToolErrorKind>Structured discriminant for tool failures. Populated by built-in
tools that can map their failure into a typed ToolErrorKind
(e.g. edit/patch setting VersionConflict on a CAS rejection
from WorkspaceError). Forwarded to the SDK so callers can react
programmatically without parsing output.
trust: ToolResultTrustV1Typed trust label applied at the value boundary. Absent wire payloads
decode as ToolResultTrustV1::WorkspaceData, matching the previous
implicit behavior for locally produced results.
Implementations§
Source§impl ToolResult
impl ToolResult
pub fn success(name: &str, output: String) -> Self
Sourcepub fn success_trusted(name: &str, output: String) -> Self
pub fn success_trusted(name: &str, output: String) -> Self
Host-trusted success: content produced by the runtime itself.
Sourcepub fn success_external(name: &str, output: String) -> Self
pub fn success_external(name: &str, output: String) -> Self
Success whose content crossed an external boundary (web, MCP, remote). Redaction review applies before prompt use.
pub fn error(name: &str, message: String) -> Self
pub fn error_with_kind(name: &str, message: String, kind: ToolErrorKind) -> Self
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
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 ToolResult
impl Debug for ToolResult
Source§impl<'de> Deserialize<'de> for ToolResult
impl<'de> Deserialize<'de> for ToolResult
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 ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnsafeUnpin for ToolResult
impl UnwindSafe for ToolResult
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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