use std::str::FromStr; /// Parses tool call arguments JSON, treating empty strings as empty objects. /// /// Many LLM providers return empty strings for tool calls with no arguments. /// This helper normalizes that behavior by converting empty strings to `{}`. pub fn parse_tool_arguments(arguments: &str) -> Result { if arguments.is_empty() { Ok(serde_json::Value::Object(Default::default())) } else { serde_json::Value::from_str(arguments) } }