pub struct ToolCallPart {
pub tool_call_id: String,
pub tool_name: String,
pub input: String,
pub provider_executed: Option<bool>,
pub dynamic: Option<bool>,
pub provider_metadata: Option<HashMap<String, HashMap<String, JsonValue>>>,
}Expand description
A request from the language model to invoke an external tool or function.
When a model detects that it needs to call a tool to accomplish a task, it emits a tool call with the tool name and arguments. The application is responsible for executing the tool and returning the results via a ToolResultPart.
§Fields
tool_call_id- Unique identifier for correlating this call with its resulttool_name- Name of the tool to invoke (must match a provided tool definition)input- Stringified JSON containing the tool argumentsprovider_executed- If true, the provider automatically executed the tooldynamic- If true, indicates a dynamic or runtime-generated tool callprovider_metadata- Optional provider-specific details
§Processing Tool Calls
When you receive a tool call, you should:
- Extract the tool name and arguments
- Locate the corresponding tool definition
- Execute the tool with the provided arguments
- Return a ToolResultPart with the results
Fields§
§tool_call_id: StringUnique identifier that correlates this tool call with its result
tool_name: StringName identifying which tool should be invoked
input: StringStringified JSON containing the arguments for the tool
provider_executed: Option<bool>Indicates whether the provider has already executed this tool
dynamic: Option<bool>Indicates whether this is a dynamic or runtime-generated tool call
provider_metadata: Option<HashMap<String, HashMap<String, JsonValue>>>Optional provider-specific metadata about the tool call
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<ToolCallPart, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCallPart, <__D as Deserializer<'de>>::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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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 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