Extract appropriate detail for a tool call. For minimal-detail tools (Read, Skill, WebFetch), returns only the essential identifier (path, skill name, URL). For other tools, returns the most relevant field from the input.
(tool_name: &str, input: &serde_json::Value)
| 295 | /// essential identifier (path, skill name, URL). For other tools, returns |
| 296 | /// the most relevant field from the input. |
| 297 | fn extract_tool_detail(tool_name: &str, input: &serde_json::Value) -> Option<String> { |
| 298 | let parsed: ToolInput = serde_json::from_value(input.clone()).unwrap_or_default(); |
| 299 | |
| 300 | // Minimal detail tools — show only the identifier |
| 301 | if MINIMAL_DETAIL_TOOLS.contains(&tool_name) { |
| 302 | return match tool_name { |
| 303 | "Skill" => parsed.skill, |
| 304 | "Read" => parsed.file_path.or(parsed.notebook_path), |
| 305 | "WebFetch" => parsed.url, |
| 306 | _ => None, |
| 307 | }; |
| 308 | } |
| 309 | |
| 310 | // Other tools — use the most relevant field |
| 311 | parsed |
| 312 | .description |
| 313 | .or(parsed.command) |
| 314 | .or_else(|| parsed.args.as_ref().map(|a| a.join(" "))) |
| 315 | .or(parsed.file_path) |
| 316 | .or(parsed.notebook_path) |
| 317 | .or(parsed.pattern) |
| 318 | } |
no test coverage detected