pub struct ToolCallOutcome {
pub call: ToolCall,
pub content: String,
pub memory_policy: ToolMemoryPolicy,
pub effect: Option<EffectRequest>,
}Expand description
The outcome of one tool call dispatch: the call info, the text fed back to the model when immediately available, recording metadata, and an optional effect request.
run produces outcomes; policies can also construct synthetic
outcomes to feed a decision back to the model without running the tool
(see the approval-gate example on ToolRoundExecutor) — the agent
records the text through the normal ToolResult channel:
use molo::agent::ToolCallOutcome;
use molo::message::ToolCall;
let denied = ToolCallOutcome {
call: ToolCall {
id: "call_1".into(),
name: "dangerous".into(),
arguments: "{}".into(),
},
content: "denied by approval gate".into(),
memory_policy: molo::ToolMemoryPolicy::Normal,
effect: None,
};Fields§
§call: ToolCallThe call as-is (with id / name / arguments, used for event pairing and locating the record).
content: StringThe text fed back (Ok result / Err’s Display, visible to the model).
memory_policy: ToolMemoryPolicyMemory policy for the model-visible content.
effect: Option<EffectRequest>Effect request produced by the tool, when the tool requested a governed side effect instead of immediate output.
Implementations§
Source§impl ToolCallOutcome
impl ToolCallOutcome
Sourcepub fn text(call: ToolCall, content: impl Into<String>) -> Self
pub fn text(call: ToolCall, content: impl Into<String>) -> Self
Constructs an immediate text outcome.
Sourcepub fn output(call: ToolCall, output: ToolOutput) -> Self
pub fn output(call: ToolCall, output: ToolOutput) -> Self
Constructs an immediate output outcome.
Sourcepub fn effect(call: ToolCall, request: EffectRequest) -> Self
pub fn effect(call: ToolCall, request: EffectRequest) -> Self
Constructs an effect outcome.
Sourcepub fn effect_request(&self) -> Option<&EffectRequest>
pub fn effect_request(&self) -> Option<&EffectRequest>
Whether this outcome requests a governed effect.