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)
| 201 | /// essential identifier (path, skill name, URL). For other tools, returns |
| 202 | /// the most relevant field from the input. |
| 203 | fn extract_tool_detail(tool_name: &str, input: &serde_json::Value) -> Option<String> { |
| 204 | let parsed: ToolInput = serde_json::from_value(input.clone()).unwrap_or_default(); |
| 205 | |
| 206 | // Minimal detail tools — show only the identifier |
| 207 | if MINIMAL_DETAIL_TOOLS.contains(&tool_name) { |
| 208 | return match tool_name { |
| 209 | "Skill" => parsed.skill, |
| 210 | "Read" => parsed.file_path.or(parsed.notebook_path), |
| 211 | "WebFetch" => parsed.url, |
| 212 | _ => None, |
| 213 | }; |
| 214 | } |
| 215 | |
| 216 | // Other tools — use the most relevant field |
| 217 | parsed |
| 218 | .description |
| 219 | .or(parsed.command) |
| 220 | .or(parsed.file_path) |
| 221 | .or(parsed.notebook_path) |
| 222 | .or(parsed.pattern) |
| 223 | } |
no test coverage detected