Record tool execution in metadata (internal method)
(&self, name: &str, duration_ms: u64)
| 385 | impl ToolRegistry { |
| 386 | /// Record tool execution in metadata (internal method) |
| 387 | fn record_tool_execution(&self, name: &str, duration_ms: u64) -> PyResult<()> { |
| 388 | let mut metadata = self.metadata.write().map_err(|e| { |
| 389 | PyErr::new::<pyo3::exceptions::PyRuntimeError, _>(format!( |
| 390 | "Failed to acquire metadata lock: {}", |
| 391 | e |
| 392 | )) |
| 393 | })?; |
| 394 | |
| 395 | if let Some(meta) = metadata.get_mut(name) { |
| 396 | meta.record_call(duration_ms); |
| 397 | } |
| 398 | |
| 399 | Ok(()) |
| 400 | } |
| 401 | |
| 402 | /// Add result to execution history (internal method) |
| 403 | fn add_to_history(&self, result: ToolResult) -> PyResult<()> { |