pub struct ToolCallPart {
pub id: ToolCallId,
pub name: String,
pub input: Value,
pub metadata: MetadataMap,
}Expand description
A tool invocation request emitted by the model.
The agent loop receives this part, executes the named tool, and appends a
ToolResultPart back to the transcript for the model to observe.
§Example
use agentkit_core::ToolCallPart;
use serde_json::json;
let call = ToolCallPart::new("call-7", "fs.read_file", json!({ "path": "src/main.rs" }));
assert_eq!(call.name, "fs.read_file");Fields§
§id: ToolCallIdUnique identifier for this tool call, used to correlate with ToolResultPart::call_id.
name: StringThe name of the tool to invoke (e.g. "fs.read_file", "shell.exec").
input: ValueThe JSON arguments to pass to the tool.
metadata: MetadataMapArbitrary key-value metadata.
Implementations§
Source§impl ToolCallPart
impl ToolCallPart
Sourcepub fn new(
id: impl Into<ToolCallId>,
name: impl Into<String>,
input: Value,
) -> Self
pub fn new( id: impl Into<ToolCallId>, name: impl Into<String>, input: Value, ) -> Self
Builds a tool-call part with empty metadata.
Sourcepub fn with_metadata(self, metadata: MetadataMap) -> Self
pub fn with_metadata(self, metadata: MetadataMap) -> Self
Replaces the tool-call metadata.
Trait Implementations§
Source§impl Clone for ToolCallPart
impl Clone for ToolCallPart
Source§fn clone(&self) -> ToolCallPart
fn clone(&self) -> ToolCallPart
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 ToolCallPart
impl Debug for ToolCallPart
Source§impl<'de> Deserialize<'de> for ToolCallPart
impl<'de> Deserialize<'de> for ToolCallPart
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 PartialEq for ToolCallPart
impl PartialEq for ToolCallPart
Source§impl Serialize for ToolCallPart
impl Serialize for ToolCallPart
impl Eq for ToolCallPart
impl StructuralPartialEq for ToolCallPart
Auto Trait Implementations§
impl Freeze for ToolCallPart
impl RefUnwindSafe for ToolCallPart
impl Send for ToolCallPart
impl Sync for ToolCallPart
impl Unpin for ToolCallPart
impl UnsafeUnpin for ToolCallPart
impl UnwindSafe for ToolCallPart
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