(result: &tracedecay::mcp::ToolResult)
| 110 | } |
| 111 | |
| 112 | fn extract_json(result: &tracedecay::mcp::ToolResult) -> Value { |
| 113 | let text = result.value["content"][0]["text"] |
| 114 | .as_str() |
| 115 | .unwrap_or_else(|| panic!("tool result should carry text content: {}", result.value)); |
| 116 | serde_json::from_str(text).unwrap_or_else(|e| panic!("tool result should be JSON: {e}\n{text}")) |
| 117 | } |
| 118 | |
| 119 | async fn call(cg: &TraceDecay, tool: &str, mut args: Value) -> Value { |
| 120 | if let Some(obj) = args.as_object_mut() { |