use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ToolCall {
pub id: String,
pub name: String,
pub arguments: Value,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ToolResult {
pub tool_call_id: String,
pub tool_name: String,
pub args: Value,
pub result: ToolOutcome,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToolOutcome {
Output(ToolOutput),
Error(String),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ToolOutput {
pub content: String,
#[serde(default)]
pub artifacts: Vec<Value>,
}
impl From<String> for ToolOutput {
fn from(content: String) -> Self {
Self {
content,
artifacts: Vec::new(),
}
}
}
impl From<&str> for ToolOutput {
fn from(content: &str) -> Self {
content.to_string().into()
}
}