(tool_input: Option<&Value>, response: &Value)
| 699 | } |
| 700 | |
| 701 | fn extract_file_path(tool_input: Option<&Value>, response: &Value) -> Option<String> { |
| 702 | for value in [tool_input, Some(response)].into_iter().flatten() { |
| 703 | for key in ["file_path", "filePath", "path"] { |
| 704 | if let Some(path) = value.get(key).and_then(Value::as_str) { |
| 705 | return Some(path.to_string()); |
| 706 | } |
| 707 | } |
| 708 | } |
| 709 | None |
| 710 | } |
| 711 | |
| 712 | fn insert_if_missing(raw: &mut Value, key: &str, value: Value) { |
| 713 | if let Some(obj) = raw.as_object_mut() { |
no test coverage detected