pub struct ToolResult {
pub tool_name: String,
pub status: ToolStatus,
pub data: Value,
pub message: Option<String>,
pub metadata: HashMap<String, Value>,
pub suspension: Option<Box<SuspendTicket>>,
}Expand description
Result of tool execution.
Fields§
§tool_name: StringTool name.
status: ToolStatusExecution status.
data: ValueResult data.
message: Option<String>Optional message.
metadata: HashMap<String, Value>Metadata.
suspension: Option<Box<SuspendTicket>>Structured suspension payload for loop-level suspension handling.
Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn success(tool_name: impl Into<String>, data: impl Into<Value>) -> Self
pub fn success(tool_name: impl Into<String>, data: impl Into<Value>) -> Self
Create a success result.
Sourcepub fn success_with_message(
tool_name: impl Into<String>,
data: impl Into<Value>,
message: impl Into<String>,
) -> Self
pub fn success_with_message( tool_name: impl Into<String>, data: impl Into<Value>, message: impl Into<String>, ) -> Self
Create a success result with message.
Sourcepub fn error(tool_name: impl Into<String>, message: impl Into<String>) -> Self
pub fn error(tool_name: impl Into<String>, message: impl Into<String>) -> Self
Create an error result.
Sourcepub fn error_with_code(
tool_name: impl Into<String>,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn error_with_code( tool_name: impl Into<String>, code: impl Into<String>, message: impl Into<String>, ) -> Self
Create a structured error result with stable error code payload.
Sourcepub fn suspended(
tool_name: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn suspended( tool_name: impl Into<String>, message: impl Into<String>, ) -> Self
Create a suspended result (waiting for external resume/decision).
Sourcepub fn suspended_with(
tool_name: impl Into<String>,
message: impl Into<String>,
ticket: SuspendTicket,
) -> Self
pub fn suspended_with( tool_name: impl Into<String>, message: impl Into<String>, ticket: SuspendTicket, ) -> Self
Create a suspended result carrying an explicit suspension envelope.
Sourcepub fn warning(
tool_name: impl Into<String>,
data: impl Into<Value>,
message: impl Into<String>,
) -> Self
pub fn warning( tool_name: impl Into<String>, data: impl Into<Value>, message: impl Into<String>, ) -> Self
Create a warning result.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self
Add metadata.
Sourcepub fn with_suspension(self, ticket: SuspendTicket) -> Self
pub fn with_suspension(self, ticket: SuspendTicket) -> Self
Attach structured suspension payload for loop-level suspension handling.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if execution succeeded.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check if execution is pending.
Sourcepub fn suspension(&self) -> Option<SuspendTicket>
pub fn suspension(&self) -> Option<SuspendTicket>
Structured suspension payload attached by with_suspension.
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ToolResult> for ToolExecutionEffect
impl From<ToolResult> for ToolExecutionEffect
Source§fn from(result: ToolResult) -> Self
fn from(result: ToolResult) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin 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
Mutably borrows from an owned value. Read more