pub struct ToolCall {
pub tool_id: ToolName,
pub params: Map<String, Value>,
pub caller_id: Option<String>,
pub context: Option<ExecutionContext>,
pub tool_call_id: String,
pub skill_name: Option<Vec<String>>,
}Expand description
Structured tool invocation from LLM.
Produced by the agent loop when the LLM emits a structured tool call (as opposed to
a legacy fenced code block). Dispatched to ToolExecutor::execute_tool_call.
§Example
use zeph_tools::{ToolCall, ExecutionContext};
use zeph_common::ToolName;
let call = ToolCall {
tool_id: ToolName::new("bash"),
params: {
let mut m = serde_json::Map::new();
m.insert("command".to_owned(), serde_json::Value::String("echo hello".to_owned()));
m
},
caller_id: Some("user-42".to_owned()),
context: Some(ExecutionContext::new().with_name("repo")),
tool_call_id: String::new(),
skill_name: None,
};
assert_eq!(call.tool_id, "bash");Fields§
§tool_id: ToolNameThe tool identifier, matching a value from ToolExecutor::tool_definitions.
params: Map<String, Value>JSON parameters for the tool call, deserialized into the tool’s parameter struct.
caller_id: Option<String>Opaque caller identifier propagated from the channel (user ID, session ID, etc.).
None for system-initiated calls (scheduler, self-learning, internal).
context: Option<ExecutionContext>Per-turn execution environment. None means use the executor default (process CWD
and inherited env), which is identical to the behaviour before this field existed.
tool_call_id: StringOpaque tool call ID used to correlate ToolEvent::OutputChunk events with
their originating tool call in the TUI. Empty when not set by the agent loop.
skill_name: Option<Vec<String>>Names of skills active in the turn that issued this tool call (turn-level attribution).
This is a best-effort, turn-scoped field: it lists the skills injected into the
system prompt for the current turn, not the specific skill that caused this individual
call (the LLM does not report per-call causation). None for system-initiated or
internal tool calls that execute outside the skill-augmented agent loop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolCall
impl RefUnwindSafe for ToolCall
impl Send for ToolCall
impl Sync for ToolCall
impl Unpin for ToolCall
impl UnsafeUnpin for ToolCall
impl UnwindSafe for ToolCall
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,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request