#[non_exhaustive]pub struct ToolCall {
pub tool_call_id: ToolCallId,
pub title: String,
pub kind: ToolKind,
pub status: ToolCallStatus,
pub content: Vec<ToolCallContent>,
pub locations: Vec<ToolCallLocation>,
pub raw_input: Option<Value>,
pub raw_output: Option<Value>,
pub meta: Option<Map<String, Value>>,
}Expand description
Represents a tool call that the language model has requested.
Tool calls are actions that the agent executes on behalf of the language model, such as reading files, executing code, or fetching data from external sources.
See protocol docs: Tool Calls
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tool_call_id: ToolCallIdUnique identifier for this tool call within the session.
title: StringHuman-readable title describing what the tool is doing.
kind: ToolKindThe category of tool being invoked. Helps clients choose appropriate icons and UI treatment.
status: ToolCallStatusCurrent execution status of the tool call.
content: Vec<ToolCallContent>Content produced by the tool call.
locations: Vec<ToolCallLocation>File locations affected by this tool call. Enables “follow-along” features in clients.
raw_input: Option<Value>Raw input parameters sent to the tool.
raw_output: Option<Value>Raw output returned by the tool.
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Implementations§
Source§impl ToolCall
impl ToolCall
pub fn new( tool_call_id: impl Into<ToolCallId>, title: impl Into<String>, ) -> ToolCall
Sourcepub fn kind(self, kind: ToolKind) -> ToolCall
pub fn kind(self, kind: ToolKind) -> ToolCall
The category of tool being invoked. Helps clients choose appropriate icons and UI treatment.
Sourcepub fn status(self, status: ToolCallStatus) -> ToolCall
pub fn status(self, status: ToolCallStatus) -> ToolCall
Current execution status of the tool call.
Sourcepub fn content(self, content: Vec<ToolCallContent>) -> ToolCall
pub fn content(self, content: Vec<ToolCallContent>) -> ToolCall
Content produced by the tool call.
Sourcepub fn locations(self, locations: Vec<ToolCallLocation>) -> ToolCall
pub fn locations(self, locations: Vec<ToolCallLocation>) -> ToolCall
File locations affected by this tool call. Enables “follow-along” features in clients.
Sourcepub fn raw_input(self, raw_input: impl IntoOption<Value>) -> ToolCall
pub fn raw_input(self, raw_input: impl IntoOption<Value>) -> ToolCall
Raw input parameters sent to the tool.
Sourcepub fn raw_output(self, raw_output: impl IntoOption<Value>) -> ToolCall
pub fn raw_output(self, raw_output: impl IntoOption<Value>) -> ToolCall
Raw output returned by the tool.
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> ToolCall
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> ToolCall
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT make assumptions about values at these keys.
See protocol docs: Extensibility
Sourcepub fn update(&mut self, fields: ToolCallUpdateFields)
pub fn update(&mut self, fields: ToolCallUpdateFields)
Update an existing tool call with the values in the provided update fields. Fields with collections of values are overwritten, not extended.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolCall
impl<'de> Deserialize<'de> for ToolCall
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCall, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolCall, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<ToolCall> for ToolCallUpdate
impl From<ToolCall> for ToolCallUpdate
Source§fn from(value: ToolCall) -> ToolCallUpdate
fn from(value: ToolCall) -> ToolCallUpdate
Source§impl JsonSchema for ToolCall
impl JsonSchema for ToolCall
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for ToolCall
impl Serialize for ToolCall
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,
Source§impl TryFrom<ToolCallUpdate> for ToolCall
If a given tool call doesn’t exist yet, allows for attempting to construct
one from a tool call update if possible.
impl TryFrom<ToolCallUpdate> for ToolCall
If a given tool call doesn’t exist yet, allows for attempting to construct one from a tool call update if possible.