#[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<Meta>,
}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<Meta>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>, ) -> Self
Sourcepub fn kind(self, kind: ToolKind) -> Self
pub fn kind(self, kind: ToolKind) -> Self
The category of tool being invoked. Helps clients choose appropriate icons and UI treatment.
Sourcepub fn status(self, status: ToolCallStatus) -> Self
pub fn status(self, status: ToolCallStatus) -> Self
Current execution status of the tool call.
Sourcepub fn content(self, content: Vec<ToolCallContent>) -> Self
pub fn content(self, content: Vec<ToolCallContent>) -> Self
Content produced by the tool call.
Sourcepub fn locations(self, locations: Vec<ToolCallLocation>) -> Self
pub fn locations(self, locations: Vec<ToolCallLocation>) -> Self
File locations affected by this tool call. Enables “follow-along” features in clients.
Sourcepub fn raw_input(self, raw_input: impl IntoOption<Value>) -> Self
pub fn raw_input(self, raw_input: impl IntoOption<Value>) -> Self
Raw input parameters sent to the tool.
Sourcepub fn raw_output(self, raw_output: impl IntoOption<Value>) -> Self
pub fn raw_output(self, raw_output: impl IntoOption<Value>) -> Self
Raw output returned by the tool.
Sourcepub fn meta(self, meta: impl IntoOption<Meta>) -> Self
pub fn meta(self, meta: impl IntoOption<Meta>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ToolCall> for ToolCallUpdate
impl From<ToolCall> for 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 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.